export

  • 用法
  1. Usage: docker export [OPTIONS] CONTAINER
  2. Export a filesystem as a tar archive (streamed to STDOUT by default)
  3. --help=false Print usage
  4. -o, --output= Write to a file, instead of STDOUT
  • 例子
  1. $ sudo docker export b448f729a0b0 > centos.tar
  • 总结

把容器系统文件打包并导出来,方便分发给其他场景使用。

import

  • 用法
  1. Usage: docker import [OPTIONS] URL|- [REPOSITORY[:TAG]]
  2. Create an empty filesystem image and import the contents of the
  3. tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then
  4. optionally tag it.
  5. -c, --change=[] Apply Dockerfile instruction to the created image
  6. --help=false Print usage
  • 例子

从网络上导入:

  1. $ sudo docker import http://example.com/exampleimage.tgz

从本地文件导入:

通过标准输入和pipe导入到docker.

  1. $ cat exampleimage.tgz | sudo docker import - exampleimagelocal:new

从本地目录导入:

  1. $ sudo tar -c . | docker import - exampleimagedir

带配置信息从本地目录导入:

  1. $ sudo tar -c . | docker import --change "ENV DEBUG true" - exampleimagedir
  • 总结

暂无