阿里云镜像公共仓库使用
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.登录阿里云管理界面
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 ~]#