[root@chy ~]
Usage: docker
export
[OPTIONS] CONTAINER
Export a container's filesystem as a
tar
archive
Options:
--help Print usage
-o, --output string Write to a
file
, instead of STDOUT
从帮助可以看出,docker
export
是用来将container的文件系统进行打包的例如:
[root@chy ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0db570b5560b centos
"/bin/bash"
13 minutes ago Up 13 minutes stupefied_dubinsky
6be67419cafc centos_with_net
"bash"
18 hours ago Up 18 hours centos6
[root@chy ~]
[root@chy ~]
-rw------- 1 root root 205216256 11月 15 21:33 centos-
export
.
tar
将打包的container载入进来使用docker
import
,例如:
[root@chy ~]
sha256:e3a5b72ba5712840a2000ac229557c32cc656a56836120e194c9934ba392c990
[root@chy ~]
REPOSITORY TAG IMAGE ID CREATED SIZE
centos1 latest e3a5b72ba571 4 seconds ago 197MB
centos latest cc10a4837129 2 minutes ago 197MB
192.168.212.10:5000
/centos7
latest 3e6c83d2f374 22 hours ago 435MB
centos7 latest 3e6c83d2f374 22 hours ago 435MB
centos_with_net latest 87dde0ff7187 43 hours ago 277MB
registry latest a07e3f32a779 11 days ago 33.3MB
centos <none> d123f4e55e12 11 days ago 197MB
[root@chy ~]
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0db570b5560b d123f4e55e12
"/bin/bash"
20 minutes ago Up 20 minutes stupefied_dubinsky
6be67419cafc centos_with_net
"bash"
18 hours ago Up 18 hours
从上面的案例不难看出docker
import
将container导入后会成为一个image,而不是恢复为一个container。