Skip to main content

A command line utility effectively replicating `docker save` except that it will only save the LAST layer of the image in the output archive.

Project description

docker-save-last Command Line Utility

This is a command line utility effectively replicating docker save except that it will only save the LAST layer of the image in the output archive.

This is especially useful when combined with the experimental docker build --squash option, because it allows you to export only your changes on top of the base image without the entire base image file system in the output archive.

This means HUGE savings in file size.

General discussion on the issue can be found here: https://github.com/moby/moby/issues/8039

Installation

Use pip to install: pip install d-save-last

Required Dependencies

  1. docker installed, on the PATH, and usable without sudo.

Usage

Typical usage will look like d-save-last -o ./path/to/output.tar YOUR_IMAGE_ID

Arguments and options are identical to docker save see docker save --help.

$ docker save -h

Usage:	docker save [OPTIONS] IMAGE [IMAGE...]

Save one or more images to a tar archive (streamed to STDOUT by default)

Options:
  -o, --output string   Write to a file, instead of STDOUT

How does it work?

This utility uses the special docker-in-docker image from https://github.com/brthor/dind-save

That docker image contains a version of the docker daemon with patches to docker save built from https://github.com/brthor/engine

The utility launches the dind-save image in a container, and connects to its docker daemon over TCP.

Caveats

  • This is currently only tested with host machines that use the overlay2 storage driver. Any other storage driver will almost certainly not work.

  • Currently only supports docker version 18.09. Adding new versions requires changes in the docker daemon and dind-save image repository. Open an issue if you'd like a new version added for your purposes.

Feel free to contribute here if any of these are an issue and you'd like to use this utility. Pull Requests will be reviewed quickly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for d-save-last, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size d_save_last-0.1.2-py2-none-any.whl (6.0 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size d-save-last-0.1.2.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page