导出镜像

image.png

  1. [root@docker nginx]# docker save nginx:v1 -o /tmp/nginx:v1.tar
  2. You have new mail in /var/mail/root
  3. [root@docker nginx]# ls /tmp/nginx\:v1.tar
  4. /tmp/nginx:v1.tar

导入镜像:

image.png

  1. [root@master nginx]# ll
  2. total 492624
  3. -rw-r--r-- 1 root root 174 Dec 30 00:05 nginx-pod.yaml
  4. -rw-r--r-- 1 root root 504441344 Dec 30 02:22 nginx_v1.tar
  5. [root@master nginx]# pwd
  6. /root/nginx
  7. [root@master nginx]# docker load -i /root/nginx/nginx_v1.tar
  8. af6bf1987c2e: Loading layer [==================================================>] 201.5MB/201.5MB
  9. ca490ff33751: Loading layer [==================================================>] 279.9MB/279.9MB
  10. b5ad1992ec6e: Loading layer [==================================================>] 1.018MB/1.018MB
  11. 6cba6b322bd8: Loading layer [==================================================>] 21.95MB/21.95MB
  12. 39aced039907: Loading layer [==================================================>] 6.144kB/6.144kB
  13. Loaded image: nginx:v1
  14. [root@master nginx]# docker images |grep nginx
  15. nginx v1 6c9d6c6a3878 2 hours ago 494MB
  16. [root@master nginx]#

分发到各节点或本地离线镜像仓库:

[root@master nginx]# scp nginx_v1.tar node1:/home/
nginx_v1.tar 100% 481MB 69.4MB/s 00:06
[root@master nginx]# scp nginx_v1.tar node2:/home/
nginx_v1.tar 100% 481MB 68.7MB/s 00:07