把自己创建的镜像 PUSH 到 阿里云 的镜像仓库

1、注册阿里云容器镜像服务帐号,并进行登陆,并创建镜像仓库

阿里云 容器镜像服务 站点
在这里插入图片描述

2、点击管理,查看操作指南

在这里插入代码片

3、在宿主机上进行登陆,并对镜像 TAG 修改

### 进行登陆 ###
[root@Tang ~]# docker login --username=jcl***5 registry.cn-hangzhou.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@Tang ~]# docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
busyboxhttpd        latest              91417fc42ce4        22 minutes ago      1.22MB
busyboxnewdir       v2                  7bc5297b34ed        37 minutes ago      1.22MB
busyboxnewdir       v1                  8f6e7890958b        42 minutes ago      1.22MB
nginx               latest              231d40e811cd        5 days ago          126MB
centos              7                   5e35e350aded        2 weeks ago         203MB
busybox             latest              020584afccce        4 weeks ago         1.22MB
### 修改 TAG ###
[root@Tang ~]# docker image tag busyboxhttpd:latest registry.cn-hangzhou.aliyuncs.com/tangneo/busyboxhttpd:latest

### 查看镜像列表 ###
[root@Tang ~]# docker image ls
REPOSITORY                                               TAG                 IMAGE ID            CREATED             SIZE
busyboxhttpd                                             latest              91417fc42ce4        23 minutes ago      1.22MB
registry.cn-hangzhou.aliyuncs.com/tangneo/busyboxhttpd   latest              91417fc42ce4        23 minutes ago      1.22MB
busyboxnewdir                                            v2                  7bc5297b34ed        38 minutes ago      1.22MB
busyboxnewdir                                            v1                  8f6e7890958b        43 minutes ago      1.22MB
nginx                                                    latest              231d40e811cd        5 days ago          126MB
centos                                                   7                   5e35e350aded        2 weeks ago         203MB
busybox                                                  latest              020584afccce        4 weeks ago         1.22MB

### PUSH 镜像 ###
[root@Tang ~]# docker push registry.cn-hangzhou.aliyuncs.com/tangneo/busyboxhttpd:latest
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/tangneo/busyboxhttpd]
b6b3ee7232eb: Pushed 
1da8e4c8d307: Pushed 
latest: digest: sha256:d19b4229b2a63d7bb1bb0e8e6bc988c031afac360d0d90b5fefab726c49669ba size: 734

4、查看镜像版本,看是否 PUSH 成功

在这里插入图片描述

5、在别的主机上进行镜像下载

### 首先登陆 ###
[root@Tang-1 ~]# docker login --username=j******5 registry.cn-hangzhou.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

### 进行 PULL ###
[root@Tang-1 ~]# docker image pull registry.cn-hangzhou.aliyuncs.com/tangneo/busyboxhttpd
Using default tag: latest
latest: Pulling from tangneo/busyboxhttpd
0f8c40e1270f: Pull complete 
329d591df313: Pull complete 
Digest: sha256:d19b4229b2a63d7bb1bb0e8e6bc988c031afac360d0d90b5fefab726c49669ba
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/tangneo/busyboxhttpd:latest
registry.cn-hangzhou.aliyuncs.com/tangneo/busyboxhttpd:latest

### 查看是否下载成功 ###
[root@Tang-1 ~]# docker image ls
REPOSITORY                                               TAG                 IMAGE ID            CREATED             SIZE
registry.cn-hangzhou.aliyuncs.com/tangneo/busyboxhttpd   latest              91417fc42ce4        2 hours ago         1.22MB
172.16.141.209:5000/centos                               7                   5e35e350aded        2 weeks ago         203MB
发布了158 篇原创文章 · 获赞 7 · 访问量 9738

猜你喜欢

转载自blog.csdn.net/weixin_44983653/article/details/103291074