【Docker】本地镜像发布到阿里云

发布流程

【Docker】本地镜像发布到阿里云_第1张图片

推送步骤

做好本地镜像

[root@192 ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED         SIZE
kd/myubuntu   1.1       dac744a2b764   4 seconds ago   183MB
ubuntu        latest    ba6acccedd29   17 months ago   72.8MB
redis         6.0.8     16ecd2772934   2 years ago     104MB

这里就使用之前创建的kd/myubuntu。

进入阿里云开发者平台。

地址:https://www.aliyun.com/
【Docker】本地镜像发布到阿里云_第2张图片

【Docker】本地镜像发布到阿里云_第3张图片

创建命名空间

【Docker】本地镜像发布到阿里云_第4张图片

创建镜像仓库

【Docker】本地镜像发布到阿里云_第5张图片
【Docker】本地镜像发布到阿里云_第6张图片
【Docker】本地镜像发布到阿里云_第7张图片

【Docker】本地镜像发布到阿里云_第8张图片

将镜像推送到阿里云registry

  • docker login

    [root@192 ~]# docker login --username=*** 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
    
  • docker tag

    [root@192 ~]# docker tag dac744a2b764 registry.cn-hangzhou.aliyuncs.com/kuangdi1992/myubuntu1.1:1.1
    
  • docker push

    [root@192 ~]# docker push registry.cn-hangzhou.aliyuncs.com/kuangdi1992/myubuntu1.1:1.1
    The push refers to repository [registry.cn-hangzhou.aliyuncs.com/kuangdi1992/myubuntu1.1]
    42734647de38: Pushed 
    9f54eef41275: Pushed 
    1.1: digest: sha256:cae4cd8d86c1877b6adcd44fab1a4326238d4dd4ab56fffdbd11e7ee5f8f0f18 size: 741
    

将阿里云上的镜像下载到本地

[root@192 ~]# docker images
REPOSITORY                                                  TAG       IMAGE ID       CREATED          SIZE
kd/myubuntu                                                 1.1       dac744a2b764   36 minutes ago   183MB
registry.cn-hangzhou.aliyuncs.com/kuangdi1992/myubuntu1.1   1.1       dac744a2b764   36 minutes ago   183MB
ubuntu                                                      latest    ba6acccedd29   17 months ago    72.8MB
redis                                                       6.0.8     16ecd2772934   2 years ago      104MB
[root@192 ~]# docker rmi -f dac744a2b764
Untagged: kd/myubuntu:1.1
Untagged: registry.cn-hangzhou.aliyuncs.com/kuangdi1992/myubuntu1.1:1.1
Untagged: registry.cn-hangzhou.aliyuncs.com/kuangdi1992/myubuntu1.1@sha256:cae4cd8d86c1877b6adcd44fab1a4326238d4dd4ab56fffdbd11e7ee5f8f0f18
Deleted: sha256:dac744a2b764116c33700f4bd13853bed724ffbffdfb368fd60690f8b2ed9f79
[root@192 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
ubuntu       latest    ba6acccedd29   17 months ago   72.8MB
redis        6.0.8     16ecd2772934   2 years ago     104MB
[root@192 ~]# docker pull registry.cn-hangzhou.aliyuncs.com/kuangdi1992/myubuntu1.1:1.1
1.1: Pulling from kuangdi1992/myubuntu1.1
7b1a6ab2e44d: Already exists 
87b04711b41e: Already exists 
Digest: sha256:cae4cd8d86c1877b6adcd44fab1a4326238d4dd4ab56fffdbd11e7ee5f8f0f18
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/kuangdi1992/myubuntu1.1:1.1
registry.cn-hangzhou.aliyuncs.com/kuangdi1992/myubuntu1.1:1.1
[root@192 ~]# docker images
REPOSITORY                                                  TAG       IMAGE ID       CREATED          SIZE
registry.cn-hangzhou.aliyuncs.com/kuangdi1992/myubuntu1.1   1.1       dac744a2b764   38 minutes ago   183MB
ubuntu                                                      latest    ba6acccedd29   17 months ago    72.8MB
redis                                                       6.0.8     16ecd2772934   2 years ago      104MB

问题

在登录阿里云Docker Registry时出现如下问题:

[root@192 ~]# docker login --username=*** registry.cn-hangzhou.aliyuncs.com
Password: 
Error response from daemon: Get "https://registry.cn-hangzhou.aliyuncs.com/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

解决办法:

https://www.cnblogs.com/wangzy-Zj/p/16873237.html

你可能感兴趣的:(docker,阿里云,容器)