#docker #docker-image #cargo #drive #cargo-subcommand #ext4 #command-line-tool

bin+lib whaledrive

A simple cli utility to download docker images and create ext4 .img files from them

1 unstable release

0.0.1 Aug 20, 2024

#9 in #ext4

MIT license

36KB
712 lines

WhaleDrive

A simple cli utility to download docker images and create ext4 .img files from them.

This utility outputs human readable JSON to stdout. This allows the user to easily pipe the output to other tools like jq.

Installation

You can install the utility with cargo:

cargo install whaledrive

Usage

The whaledrive utility helps you manage container images efficiently with various commands and global options.

Global Options

-b, --base-path <path>

Specify the folder where this utility will store data. The default is the data folder in the current working directory.

Commands

  • info: Get info about an image
    cargo whaledrive info <image> [--os <os>] [--architecture <arch>]
    
    • image: The name and optional tag of the image (e.g., ubuntu:20.04).
    • --os: The operating system the image is for (default: linux).
    • --architecture: The architecture the image is for (default: amd64).
  • build: Create an image from a registry
    cargo whaledrive build <image> [--os <os>] [--architecture <arch>]
    
    • image: The name and optional tag of the image.
    • --os: The operating system the image is for (default: linux).
    • --architecture: The architecture the image is for (default: amd64).
  • images: List all images currently stored
    cargo whaledrive images [--os <os>] [--platform <platform>]
    
    • --os: Filter by operating system.
    • --platform: Filter by platform.
  • rm: Remove an image
    cargo whaledrive rm <image> [--prune] [--os <os>] [--architecture <arch>]
    
    • image: The name and optional tag of the image.
    • --prune: Also remove unreferenced layers associated with the image.
    • --os: Specify the operating system the image is for.
    • --architecture: Specify the architecture the image is for.
  • prune: Remove unreferenced images and layers
    cargo whaledrive prune
    

Examples

Get info about an Ubuntu image:

cargo whaledrive info ubuntu:20.04

Build an image for arm64:

cargo whaledrive build myimage --architecture arm64

List images for a specific OS:

cargo whaledrive images --os linux

Remove an image and clean up unused layers:

cargo whaledrive rm myimage --prune

Dependencies

~23–37MB
~676K SLoC