在阿里云创建私有仓库上传并拉取

爷,独闯天下 提交于 2019-12-02 11:11:34

在阿里云上创建私有仓库,为后面的微服务上传镜像做准备,后面会安装harbor

操作指南:

1. 登录阿里云Docker Registry

$ sudo docker login --username=wgr332574835 registry.cn-hangzhou.aliyuncs.com

用于登录的用户名为阿里云账号全名,密码为开通服务时设置的密码。

您可以在产品控制台首页修改登录密码。

2. 从Registry中拉取镜像

$ sudo docker pull registry.cn-hangzhou.aliyuncs.com/dalianpai/topcheer:[镜像版本号]

3. 将镜像推送到Registry

$ sudo docker login --username=wgr332574835 registry.cn-hangzhou.aliyuncs.com$ sudo docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/dalianpai/topcheer:[镜像版本号]$ sudo docker push registry.cn-hangzhou.aliyuncs.com/dalianpai/topcheer:[镜像版本号]

请根据实际镜像信息替换示例中的[ImageId]和[镜像版本号]参数。

演示

 1 [root@topcheer ~]# sudo docker login --username=wgr332574835 registry.cn-hangzhou.aliyuncs.com
 2 Password:
 3 Login Succeeded
 4 [root@topcheer ~]# docker images
 5 REPOSITORY                     TAG                 IMAGE ID            CREATED             SIZE
 6 docker.io/openzipkin/zipkin    latest              17c2bb09f482        4 days ago          154 MB
 7 docker.io/mysql                latest              c8ee894bd2bd        8 days ago          456 MB
 8 elasticsearch                  latest              874179f19603        3 weeks ago         771 MB
 9 docker.io/nacos/nacos-server   latest              a4229ac5cc19        4 weeks ago         710 MB
10 springbootdemo4docker          latest              cd13bc7f56a0        4 weeks ago         678 MB
11 docker.io/tomcat               latest              ee48881b3e82        6 weeks ago         506 MB
12 docker.io/rabbitmq             latest              a00bc560660a        6 weeks ago         147 MB
13 docker.io/centos               latest              67fa590cfc1c        2 months ago        202 MB
14 docker.io/redis                latest              f7302e4ab3a8        2 months ago        98.2 MB
15 docker.io/rabbitmq             3.7.16-management   3f92e6354d11        3 months ago        177 MB
16 docker.io/elasticsearch        6.8.0               d0b291d7093b        5 months ago        895 MB
17 docker.io/hello-world          latest              fce289e99eb9        9 months ago        1.84 kB
18 docker.io/java                 8                   d23bdf5b1b1b        2 years ago         643 MB
19 [root@topcheer ~]# docker tag 17c2bb09f482 registry.cn-hangzhou.aliyuncs.com/dalianpai/topcheer:zipkin
20 [root@topcheer ~]# sudo docker push registry.cn-hangzhou.aliyuncs.com/dalianpai/topcheer:zipkin
21 The push refers to a repository [registry.cn-hangzhou.aliyuncs.com/dalianpai/topcheer]
22 9dd6b7174575: Pushed
23 424bbd0625b0: Pushed
24 d1a5ddc76f3a: Pushed
25 18a2e61aaa33: Pushed
26 6189abe095d5: Pushed
27 922fa14a45ca: Pushed
28 f47163e8de57: Pushed
29 0d1435bd79e4: Pushed
30 zipkin: digest: sha256:80c5aef490522ffd3f377fb670fdb153e0455d15e3031a3d605b3b03aaf95e04 size: 1998
31 ​
32 [root@topcheer ~]# docker images
33 REPOSITORY                                             TAG                 IMAGE ID            CREATED             SIZE
34 registry.cn-hangzhou.aliyuncs.com/dalianpai/topcheer   zipkin              17c2bb09f482        4 days ago          154 MB
35 docker.io/mysql                                        latest              c8ee894bd2bd        8 days ago          456 MB
36 elasticsearch                                          latest              874179f19603        3 weeks ago         771 MB
37 docker.io/nacos/nacos-server                           latest              a4229ac5cc19        4 weeks ago         710 MB
38 springbootdemo4docker                                  latest              cd13bc7f56a0        4 weeks ago         678 MB
39 docker.io/tomcat                                       latest              ee48881b3e82        6 weeks ago         506 MB
40 docker.io/rabbitmq                                     latest              a00bc560660a        6 weeks ago         147 MB
41 docker.io/centos                                       latest              67fa590cfc1c        2 months ago        202 MB
42 docker.io/redis                                        latest              f7302e4ab3a8        2 months ago        98.2 MB
43 docker.io/rabbitmq                                     3.7.16-management   3f92e6354d11        3 months ago        177 MB
44 docker.io/elasticsearch                                6.8.0               d0b291d7093b        5 months ago        895 MB
45 docker.io/hello-world                                  latest              fce289e99eb9        9 months ago        1.84 kB
46 docker.io/java                                         8                   d23bdf5b1b1b        2 years ago         643 MB
47 [root@topcheer ~]#
48 ​
49 ​

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!