Skip to main content

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.

Metadata

Release files for d-save-last 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for d-save-last 0.1.2
File Size Uploaded
d-save-last-0.1.2.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for d-save-last 0.1.2
File Interpreter ABI Platform
d_save_last-0.1.2-py2-none-any.whl Python 2 none any Details

Total release size: 10.0 kB

Release files / d-save-last-0.1.2.tar.gz

Download URL d-save-last-0.1.2.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ee6fdf55b8f6615c803c95d3b724363a4e8cea20f40cc651510e97b1559dd60c
BLAKE2b-256 checksum
How to use checksums
4e8e053003b25bfbea74c8f49322c8b7d1dceaafd918a1c88525cce917202853
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10

Release files / d_save_last-0.1.2-py2-none-any.whl

Download URL d_save_last-0.1.2-py2-none-any.whl
Size 6.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
a4352c06e6c2c87e524e67b20b19b3ad8b828dc987e1082e0153f8380b7c37ad
BLAKE2b-256 checksum
How to use checksums
55a40b70ca988343bf899b0dcceddb6919a2452994d9f74a334638c629517a43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page