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.

Source Distribution

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

Uploaded Source

Built Distribution

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

Uploaded Python 2

File details

Details for the file d-save-last-0.1.2.tar.gz.

File metadata

  • Download URL: d-save-last-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for d-save-last-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ee6fdf55b8f6615c803c95d3b724363a4e8cea20f40cc651510e97b1559dd60c
MD5 e26afd19bbb6998043cfcbae2e66a357
BLAKE2b-256 4e8e053003b25bfbea74c8f49322c8b7d1dceaafd918a1c88525cce917202853

See more details on using hashes here.

File details

Details for the file d_save_last-0.1.2-py2-none-any.whl.

File metadata

  • Download URL: d_save_last-0.1.2-py2-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 2
  • Uploaded using 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

File hashes

Hashes for d_save_last-0.1.2-py2-none-any.whl
Algorithm Hash digest
SHA256 a4352c06e6c2c87e524e67b20b19b3ad8b828dc987e1082e0153f8380b7c37ad
MD5 53e3af71a01c4fea525adae6ed56e4d4
BLAKE2b-256 55a40b70ca988343bf899b0dcceddb6919a2452994d9f74a334638c629517a43

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page