From 28b535f82596084c9de51ba021e1c46900806d23 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 1 May 2014 00:26:24 -0400 Subject: [PATCH] docker save: ability to save multiple images Now from a single invocation of `docker save`, you can specify multiple images to include in the output tar, or even just multiple tags of a particular image/repo. ``` > docker save -o bundle.tar busybox ubuntu:lucid ubuntu:saucy fedora:latest > tar tf ./bundle.tar | wc -l 42 > tar xOf ./bundle.tar repositories {"busybox":{"latest":"2d8e5b282c81244037eb15b2068e1c46319c1a42b80493acb128da24b2090739"},"fedora":{"latest":"58394af373423902a1b97f209a31e3777932d9321ef10e64feaaa7b4df609cf9"},"ubuntu":{"lucid":"9cc9ea5ea540116b89e41898dd30858107c1175260fb7ff50322b34704092232","saucy":"9f676bd305a43a931a8d98b13e5840ffbebcd908370765373315926024c7c35e"}} ``` Further, this fixes the bug where the `repositories` file is not created when saving a specific tag of an image (e.g. ubuntu:latest) document multi-image save and updated API docs Docker-DCO-1.1-Signed-off-by: Vincent Batts (github: vbatts) --- docs/sources/reference/commandline/cli.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/sources/reference/commandline/cli.md b/docs/sources/reference/commandline/cli.md index f67527b380..ef30113882 100644 --- a/docs/sources/reference/commandline/cli.md +++ b/docs/sources/reference/commandline/cli.md @@ -1249,17 +1249,17 @@ Providing a maximum restart limit is only valid for the ** on-failure ** policy. ## save - Usage: docker save [OPTIONS] IMAGE + Usage: docker save [OPTIONS] IMAGE [IMAGE...] - Save an image to a tar archive (streamed to STDOUT by default) + Save an image(s) to a tar archive (streamed to STDOUT by default) -o, --output="" Write to an file, instead of STDOUT -Produces a tarred repository to the standard output stream. Contains all -parent layers, and all tags + versions, or specified repo:tag. +Produces a tarred repository to the standard output stream. +Contains all parent layers, and all tags + versions, or specified repo:tag, for +each argument provided. -It is used to create a backup that can then be used with -`docker load` +It is used to create a backup that can then be used with ``docker load`` $ sudo docker save busybox > busybox.tar $ ls -sh busybox.tar @@ -1270,6 +1270,11 @@ It is used to create a backup that can then be used with $ sudo docker save -o fedora-all.tar fedora $ sudo docker save -o fedora-latest.tar fedora:latest +It is even useful to cherry-pick particular tags of an image repository + + $ sudo docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy + + ## search Search [Docker Hub](https://hub.docker.com) for images