Crates.io | dockpack |
lib.rs | dockpack |
version | 0.1.5 |
source | src |
created_at | 2024-08-30 16:23:56.995986 |
updated_at | 2024-12-08 01:36:14.500502 |
description | Command line tool for unpacking files from Docker images |
homepage | |
repository | |
max_upload_size | |
id | 1357872 |
size | 23,909 |
basic library for distributing files via docker
This tool is for unpacking the files from a Docker image into a directory, essentially enabling you to use Docker to distribute files. Because Docker is integrated into every major cloud provider and CI/CD tool, and has caching and version control built-in, you can use Dockpack to package and distribute private code libraries of any language. You can also combine multiple projects and tools in different language into a single Docker image for distribution. I've personally used this tool todistribute private Rust code libraries, trained ML models, and private python packages. I've also used it to bundle multiple tools and scripts together to setup a build package for servers.
I plan on supporting brew
and apt get
in the future but for now you can
install the tool with cargo by using the following command:
cargo install dockpack
To unpack the files from a Docker image into a directory, you can the following pull
command:
dockpack pull -i <image> -d <directory>
For a toy example, you can unpack the maxwellflitton/nan-one
image into a directory called cache
with the command below:
dockpack pull -i maxwellflitton/nan-one -d cache
This will give you the following file structure:
├── cache
│ ├── Cargo.toml
│ ├── src
│ │ └── lib.rs
│ └── tar
│ ├── <Various tar files from the Docker image>
You can pack all files and subdirectories in the current working directory (except for anything in the .dockerignore
file) into a Docker image with the following build
command:
dockpack build -i <image>
We can then push the image to a Docker registry with the following push
command:
dockpack push -i <image>
Though to be honest, a standard docker push will work just fine as you will see the packed files in you local images.
push
command to pack pushbuild
command to pack files into a Docker imagels
command to list all the unpacked imagesrm
command to remove unpacked images