关于docker的save的用法以及示例

[root@dangcafe home]# docker ps 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[root@dangcafe home]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
kong                1.0                 86256957228d        2 months ago        2.87GB
centos              v1                  1024ee7245d7        2 months ago        1.03GB
[root@dangcafe home]# docker commit --help

Usage:	docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

Create a new image from a container's changes

Options:
  -a, --author string    Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")
  -c, --change list      Apply Dockerfile instruction to the created image
  -m, --message string   Commit message
  -p, --pause            Pause container during commit (default true)
[root@dangcafe home]# docker commit 073a904098fa xian:1.0
sha256:50a5c7165c3bc75ff068524b6ac6b15a6d9032211fa489715fd5eee670580690
[root@dangcafe home]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
xian                1.0                 50a5c7165c3b        9 seconds ago       2.25GB
kong                1.0                 86256957228d        2 months ago        2.87GB
centos              v1                  1024ee7245d7        2 months ago        1.03GB
[root@dangcafe home]# docker save -o xian_1.0.tar xian:1.0
[root@dangcafe home]# ls
cjm-xjd  dangcafe  docker  docker-18.03.1-ce.tgz  kong-1.0.tar  python37_miniconda_oracleclient12_centos7_base.tar  xian_1.0.tar
[root@dangcafe home]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES
073a904098fa        1024ee7245d7        "bash"              9 hours ago         Exited (137) 16 minutes ago                       focused_hugle
6714a081807d        86256957228d        "bash"              9 hours ago         Exited (137) 12 hours ago                         stupefied_borg
[root@dangcafe home]# 
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐