阿里雲鏡像公共倉庫使用
作者:尹正傑
版權聲明:原創作品,謝絕轉載!否則將追究法律責任。
一.登錄阿里雲管理界面
1>.訪問阿里雲官網(https://www.aliyun.com/)

2>.登錄阿里雲

3>.自定義命名空間(阿里的命名空間有點類似於咱們常說的項目名稱)

4>.點擊"創建鏡像倉庫"

5>.選擇鏡像倉庫類型

6>.鏡像創建成功后,點擊"管理"

7>.查看鏡像的管理方式

二.將本地鏡像推送到阿里雲倉庫
1>.查看上一步創建命名空間的鏡像信息

2>.在命令中中登錄阿里雲
[root@docker101.yinzhengjie.org.cn ~]# docker login --username=你的阿里雲賬號 registry.cn-beijing.aliyuncs.com 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@docker101.yinzhengjie.org.cn ~]#

3>.對本地鏡像打tag編號
[root@docker101.yinzhengjie.org.cn ~]# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE centos-haproxy v1.8.20 1858fe05d96f 3 hours ago 606MB tomcat-app01 v0.1 bf45c22f2d5b 21 hours ago 983MB tomcat-base 8.5.50 9ff79f369094 2 days ago 968MB jdk-base 1.8.0_231 0f63a97ddc85 2 days ago 953MB centos-base 7.6.1810 b4931fd9ace2 2 days ago 551MB centos centos7.6.1810 f1cb7c7d58b7 10 months ago 202MB [root@docker101.yinzhengjie.org.cn ~]# [root@docker101.yinzhengjie.org.cn ~]# [root@docker101.yinzhengjie.org.cn ~]# docker image tag centos:centos7.6.1810 registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos:v0.1_centos7.6.1810 [root@docker101.yinzhengjie.org.cn ~]# [root@docker101.yinzhengjie.org.cn ~]# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE centos-haproxy v1.8.20 1858fe05d96f 3 hours ago 606MB tomcat-app01 v0.1 bf45c22f2d5b 21 hours ago 983MB tomcat-base 8.5.50 9ff79f369094 2 days ago 968MB jdk-base 1.8.0_231 0f63a97ddc85 2 days ago 953MB centos-base 7.6.1810 b4931fd9ace2 2 days ago 551MB centos centos7.6.1810 f1cb7c7d58b7 10 months ago 202MB registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos v0.1_centos7.6.1810 f1cb7c7d58b7 10 months ago 202MB [root@docker101.yinzhengjie.org.cn ~]#

4>.將鏡像推送到阿里的Registry
[root@docker101.yinzhengjie.org.cn ~]# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE centos-haproxy v1.8.20 1858fe05d96f 3 hours ago 606MB tomcat-app01 v0.1 bf45c22f2d5b 21 hours ago 983MB tomcat-base 8.5.50 9ff79f369094 2 days ago 968MB jdk-base 1.8.0_231 0f63a97ddc85 2 days ago 953MB centos-base 7.6.1810 b4931fd9ace2 2 days ago 551MB centos centos7.6.1810 f1cb7c7d58b7 10 months ago 202MB registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos v0.1_centos7.6.1810 f1cb7c7d58b7 10 months ago 202MB [root@docker101.yinzhengjie.org.cn ~]# [root@docker101.yinzhengjie.org.cn ~]# [root@docker101.yinzhengjie.org.cn ~]# docker image push registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos:v0.1_centos7.6.1810 The push refers to repository [registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos] 89169d87dbe2: Pushed v0.1_centos7.6.1810: digest: sha256:747b2de199b6197a26eb1a24d69740d25483995842b2d2f75824095e9d1d19eb size: 529 [root@docker101.yinzhengjie.org.cn ~]#

5>. 再次查看咱們創建命名空間的鏡像信息,如下圖所示,鏡像推送成功啦~

三.將阿里雲倉庫鏡像拉取到本地
[root@docker102.yinzhengjie.org.cn ~]# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE [root@docker102.yinzhengjie.org.cn ~]# [root@docker102.yinzhengjie.org.cn ~]# [root@docker102.yinzhengjie.org.cn ~]# docker image pull registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos:v0.1_centos7.6.1810 v0.1_centos7.6.1810: Pulling from yinzhengjie2020/centos ac9208207ada: Pull complete Digest: sha256:747b2de199b6197a26eb1a24d69740d25483995842b2d2f75824095e9d1d19eb Status: Downloaded newer image for registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos:v0.1_centos7.6.1810 registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos:v0.1_centos7.6.1810 [root@docker102.yinzhengjie.org.cn ~]# [root@docker102.yinzhengjie.org.cn ~]# [root@docker102.yinzhengjie.org.cn ~]# docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE registry.cn-beijing.aliyuncs.com/yinzhengjie2020/centos v0.1_centos7.6.1810 f1cb7c7d58b7 10 months ago 202MB [root@docker102.yinzhengjie.org.cn ~]# [root@docker102.yinzhengjie.org.cn ~]#

