Leif160519的blog Leif160519的blog

——————

目录
docker如何导入导出镜像
/  

docker如何导入导出镜像


如果服务器网路不好或者pull不下来镜像,只能在其它网路比较好的机器上pull下来镜像,导出成一个文件,再下载上传到网路不好的机器上,然后再从文件中导出来,这样在网络不好的机器上也能使用docker镜像了

1.使用docker images查看本机所有的镜像文件

image.png

docker save a55fbf438dfd > ~/redis-latest.tar

将镜像保存为本地文件,其中a55fbf438dfd为image id

将保存到本地的文件上传到不能pull的服务器上,网络是相通的我这里直接使用的是scp命令即可

scp ~/redis-latest.tar root@192.168.1.1:/root

使用load方法加载刚才上传的tar文件

docker load < /root/redis-latest.tar

在新的机器上再此使用docker images命令查看本机的镜像,检查刚才load的镜像有没有加载进来,发现加载进来的镜像名称、标签均为none,使用docker tag a55fbf438dfd redis:latest修改为原来的镜像名称和标签名称,其中a55fbf438dfdimages id

使用docker run -itd redis:latest加载进行,验证镜像是否能够成功的run


“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill

标  题docker如何导入导出镜像
作  者Leif160519
出  处https://github.icu/articles/2019/08/29/1567040592743.html
关于博主:坐标六朝古都南京,服务器运维工程师+桌面运维工程师,如有问题探讨可以直接下方留言。
声援博主:如果您觉得文章对您有帮助,可以评论、订阅、收藏。您的鼓励是博主的最大动力!