1、使用aliyun的registry上传下载镜像
https://cr.console.aliyun.com/cn-hangzhou/repositories
先创建一个镜像仓库:
[root@zzz ~]# docker login --username=ctrlz registry.cn-hangzhou.aliyuncs.com #登录阿里云docker registry
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@zzz ~]# docker tag nginx:alpine registry.cn-hangzhou.aliyuncs.com/zzotest/nginx:alpine #重新打标签
[root@zzz ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx alpine cc44224bfe20 7 months ago 23.5MB
registry.cn-hangzhou.aliyuncs.com/zzotest/nginx alpine cc44224bfe20 7 months ago 23.5MB
nginx latest 605c77e624dd 7 months ago 141MB
php latest 13b9b1961ba3 8 months ago 484MB
httpd latest dabbfbe0c57b 8 months ago 144MB
test/httpd v1 dabbfbe0c57b 8 months ago 144MB
alpine latest c059bfaa849c 8 months ago 5.59MB
ubuntu latest ba6acccedd29 10 months ago 72.8MB
hello-world latest feb5d9fea6a5 11 months ago 13.3kB
tencentci/discuz latest 4833f513a33c 13 months ago 463MB
[root@zzz ~]# docker push registry.cn-hangzhou.aliyuncs.com/zzotest/nginx:alpine #上传重新打标签的镜像
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/zzotest/nginx]
419df8b60032: Pushed
0e835d02c1b5: Pushed
5ee3266a70bd: Pushed
3f87f0a06073: Pushed
1c9c1e42aafa: Pushed
8d3ac3489996: Pushed
alpine: digest: sha256:544ba2bfe312bf2b13278495347bb9381ec342e630bcc8929af124f1291784bb size: 1568
[root@zzz ~]#
在镜像仓库查看刚刚上传的镜像:
版本:
删除本地存储的nginx:alpine镜像后重新从docker registry 拉取,没有成功,可能是网络原因。
[root@zzz ~]# docker rmi nginx:alpine #删掉本地存储的nginx:alpine镜像
Untagged: nginx:alpine
Untagged: nginx@sha256:eb05700fe7baa6890b74278e39b66b2ed1326831f9ec3ed4bdc6361a4ac2f333
[root@zzz ~]# docker rmi cc4
Untagged: registry.cn-hangzhou.aliyuncs.com/zzotest/nginx:alpine
Untagged: registry.cn-hangzhou.aliyuncs.com/zzotest/nginx@sha256:544ba2bfe312bf2b13278495347bb9381ec342e630bcc8929af124f1291784bb
Deleted: sha256:cc44224bfe208a46fbc45471e8f9416f66b75d6307573e29634e7f42e27a9268
Deleted: sha256:4d6c031b167f0066022c3ba38f8fa9dfbae8a06d55e870293718252328ccae32
Deleted: sha256:f54e990cf8d2502f3ffad8a353b10d8803a1b79d69ad4114501d70ada7ecbd5c
Deleted: sha256:2ca209b6954ff2ab133490bddd8887e7a49bb5a96039db5381830aa04ff39d34
Deleted: sha256:52bcfd64a2223769f6b0f7265c2bc6e394f048c5ce883cac4f763efc3bb68ffa
Deleted: sha256:831306a8608ff75afd5e75b00bdc5e2dc5d698f6c882fbf35102b567359f8c10
[root@zzz ~]# docker pull registry.cn-hangzhou.aliyuncs.com/zzotest/nginx:alpine #从阿里云的镜像仓库拉取,没拉成功,可能是网络问题,在排查
alpine: Pulling from zzotest/nginx
59bf1c3509f3: Already exists
f3322597df46: Already exists
d09cf91cabdc: Already exists
3a97535ac2ef: Already exists
919ade35f869: Already exists
40e5d2fe5bcd: Waiting
重新上传一个alpine:latest镜像并从本地删除,然后从阿里云docker registry拉取,拉取成功。
[root@zzz ~]# docker tag alpine:latest registry.cn-hangzhou.aliyuncs.com/zzotest/alpine:latest
[root@zzz ~]# docker push registry.cn-hangzhou.aliyuncs.com/zzotest/alpine:latest
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/zzotest/alpine]
8d3ac3489996: Mounted from zzotest/nginx
latest: digest: sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3 size: 528
[root@zzz ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 605c77e624dd 7 months ago 141MB
php latest 13b9b1961ba3 8 months ago 484MB
httpd latest dabbfbe0c57b 8 months ago 144MB
test/httpd v1 dabbfbe0c57b 8 months ago 144MB
alpine latest c059bfaa849c 8 months ago 5.59MB
registry.cn