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:


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

Required Dependencies

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


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)

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

How does it work?

This utility uses the special docker-in-docker image from

That docker image contains a version of the docker daemon with patches to docker save built from

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


  • 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.

Source Distribution

d-save-last-0.1.2.tar.gz (4.0 kB view hashes)

Uploaded source

Built Distribution

d_save_last-0.1.2-py2-none-any.whl (6.0 kB view hashes)

Uploaded py2

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page