Usage: docker save [OPTIONS] IMAGE [IMAGE...] Save one or more images to a tar archive (streamed to STDOUT by default) Options: --help Print usage -o, --output string Write to a file, instead of STDOUT
输出镜像tar数据流到标准输出。包含了所有父级数据层和所有tag+version或特定的repo:tag。
一般用来备份镜像,然后使用docker load恢复。
$ docker save busybox > busybox.tar $ ls -sh busybox.tar 2.7M busybox.tar $ docker save --output busybox.tar busybox $ ls -sh busybox.tar 2.7M busybox.tar $ docker save -o fedora-all.tar fedora $ docker save -o fedora-latest.tar fedora:latest
甚至可以转存特定镜像的tag到另一个tag:
$ docker save -o ubuntu.tar ubuntu:lucid ubuntu:saucy