Docker uploads the image to the Alibaba Cloud image warehouse, and then pulls it locally

Alibaba Cloud Mirror

https://www.aliyun.com/product/acr

image-20210228154342971

If you don't have a mirror and a namespace, create one, and it's easy to get it yourself.

Create a warehouse

https://developer.aliyun.com/mirror/

image-20210228153414896

Select a local warehouse and push to the Alibaba Cloud mirror warehouse through commands

image-20210228154759626

image-20210228153508462

image-20210228153600763

Click in

image-20210228153622359

Log in to Alibaba Cloud with docker

sudo docker login --username=your username registry.cn-beijing.aliyuncs.com

Enter the password you set

[root@zjj101 ~]# sudo 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

Upload the image of the Java project to the docker warehouse

[root@zjj101 dockerdemo]# docker images
REPOSITORY                                                        TAG                 IMAGE ID            CREATED             SIZE
zjjdemohello                                                      latest              3e63062a76cc        3 minutes ago       677MB

If there is no mirror of the Java project, create one by yourself

This is the creation method

https://blog.csdn.net/qq_41489540/article/details/108670793

Add a version number to the mirror id

Command: sudo docker tag [ImageId] registry.cn-beijing.aliyuncs.com/zjjmkmkksjm/zjj101:[Image version number]

​ Just write the version number

[root@zjj101 dockerdemo]# sudo docker tag 3e63062a76cc registry.cn-beijing.aliyuncs.com/zjjmkmkksjm/zjj101:1.0
[root@zjj101 dockerdemo]#

Upload the image to the Alibaba Cloud docker warehouse

sudo docker push registry.cn-beijing.aliyuncs.com/zjjmkmkksjm/zjj101:[Mirror version number]

[root@zjj101 dockerdemo]# sudo docker push registry.cn-beijing.aliyuncs.com/zjjmkmkksjm/zjj101:1.0
The push refers to repository [registry.cn-beijing.aliyuncs.com/zjjmkmkksjm/zjj101]
1788b64716cc: Pushed
976034da0dcf: Pushed
35c20f26d188: Pushed
c3fe59dd9556: Pushed
6ed1a81ba5b6: Pushed
a3483ce177ce: Pushed
ce6c8756685b: Pushed
30339f20ced0: Pushed
0eb22bfb707d: Pushed
a2ae92ffcd29: Pushed
1.0: digest: sha256:fc86112b28dfafd11e027e9ff4e5b600e424b78f0e408fcfaf43c53b5d5f1920 size: 2424

You can see the image just pushed in the console of Alibaba Cloud Image Warehouse

image-20210228161906714

Pull the mirror from the mirror address

sudo docker pull registry.cn-beijing.aliyuncs.com/zjjmkmkksjm/zjj101:[Mirror version number]

[root@zjj101 soft]# sudo docker pull registry.cn-beijing.aliyuncs.com/zjjmkmkksjm/zjj101:1.0
1.0: Pulling from zjjmkmkksjm/zjj101
Digest: sha256:fc86112b28dfafd11e027e9ff4e5b600e424b78f0e408fcfaf43c53b5d5f1920
Status: Image is up to date for registry.cn-beijing.aliyuncs.com/zjjmkmkksjm/zjj101:1.0
registry.cn-beijing.aliyuncs.com/zjjmkmkksjm/zjj101:1.0
[root@zjj101 soft]#

View the pulled image

docker images
found more mirrors,

[root@zjj101 soft]# docker images
REPOSITORY                                                        TAG                 IMAGE ID            CREATED             SIZE
registry.cn-beijing.aliyuncs.com/zjjmkmkksjm/zjj101               1.0                 3e63062a76cc        21 minutes ago      677MB

Guess you like

Origin blog.csdn.net/qq_41489540/article/details/114228545