docker——load和save镜像重命名

将docker save 保存的tar 包在传入另一台服务器load的镜像 REPOSITORY-名字和 TAG-版本为<none >

这个问题是根本在于这个镜像压缩包在打包的时候导致
例如,以下打包方式将会导致解压的出来的镜像没有名字,原因在 7864316753 是IMAGE ID 

docker save -o redis.tar 7864316753

使用IMAGE ID打包的好处是防止镜像名重复导致docker save 失败
docker save -o

[root@localhost docker]# docker save -o myes.1.0.tar  93109ce1d590
[root@localhost docker]# ll
total 764972
-rw-------. 1 root root 783318016 Jul 17 07:40 myes.1.0.tar
[root@localhost docker]# scp myes.1.0.tar root@node1:/tmp/
root@node1's password:
myes.1.0.tar

doceker load --input ***.tar 
重命名镜像的方法:
docker tag [镜像id] [新镜像名称]:[新镜像标签]  
docker tag 93109ce1d590 5000/python-env:2.7.13

[root@localhost tmp]# ll
total 764960
-rw-------. 1 root root 783318016 Jul 17 07:49 myes.1.0.tar
[root@localhost tmp]#
[root@localhost tmp]# docker load -i myes.1.0.tar
071d8bd76517: Loading layer [==================================================>]  210.2MB/210.2MB
eb9a2ed233fb: Loading layer [==================================================>]  310.7MB/310.7MB
7af0091b1a81: Loading layer [==================================================>]  3.584kB/3.584kB
032e0c15c085: Loading layer [==================================================>]  25.03MB/25.03MB
47482c713d94: Loading layer [==================================================>]  311.3kB/311.3kB
b25c666c6ae1: Loading layer [==================================================>]  237.1MB/237.1MB
09e594d2253c: Loading layer [==================================================>]   7.68kB/7.68kB
7f87057c8ffb: Loading layer [==================================================>]  9.728kB/9.728kB
Loaded image ID: sha256:93109ce1d590482a06ba085943082b314ac188fcfdbffb68aebb00795c72bc8a
[root@localhost tmp]# docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
<none>                        <none>              93109ce1d590        19 months ago       774MB
k8s.gcr.io/kube-proxy-amd64   v1.11.1             d5c25579d0ff        2 years ago         97.8MB
quay.io/coreos/flannel        v0.10.0-amd64       f0fad859c909        2 years ago         44.6MB
k8s.gcr.io/pause              3.1                 da86e6ba6ca1        2 years ago         742kB
[root@localhost tmp]# docker tag 93109ce1d590 myes:v1
[root@localhost tmp]# docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
myes                          v1                  93109ce1d590        19 months ago       774MB
k8s.gcr.io/kube-proxy-amd64   v1.11.1             d5c25579d0ff        2 years ago         97.8MB
quay.io/coreos/flannel        v0.10.0-amd64       f0fad859c909        2 years ago         44.6MB
k8s.gcr.io/pause              3.1                 da86e6ba6ca1        2 years ago         742kB

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值