Alibaba Cloud Container Registry (Alibaba Cloud Container Registry) image push process and summary

Prerequisite: Docker is installed and configured. Please refer to my article on installing and configuring docker and docker-compose based on CentOS7 .

Alibaba Cloud Open Source Mirror Station-centos7.9.2009

1. Set access credentials

1.1 Container Image Service ACR

Log in to the Alibaba Cloud homepage , click Products - Containers - Container Image Service ACR
Insert image description here
and click Management Console
Insert image description here

1.2 Enter the console-click the instance list

Insert image description here
Personal container image hosting service, limited use
Insert image description here

1.3 Create a personal version

Insert image description here
Personal container image hosting service, limited use.
Insert image description here
Please note that the personal version does not have SLA guarantee and has usage restrictions. Please do not use it in production business.
Insert image description here
Creation
Insert image description here
is successful.
Insert image description here

1.4 Set Registry login password

Insert image description here
Click OK
Insert image description here
Click OK
Insert image description here
to initialize successfully
Insert image description here

1.5 View access credentials

Click " Access Credentials " in the picture above and copy the access credentials as shown below

Insert image description here

1.6 Copy and paste credentials Login Succeeded

Insert image description here
Login Succeeded
Insert image description here

1.7 Set a fixed password

Insert image description here
Set a fixed password and
Insert image description here
complete the mobile phone verification process
Insert image description here

1.8 Personal version is running

Insert image description here

1.9 The first step of access credentials - setting the access password is completed (displayed in the lower right corner)

Insert image description here

1.10 The Personal Edition of Container Image Service will cancel the image security scanning-image synchronization function of Personal Edition instances from August 20, 2023.

Insert image description here

2. Create a namespace

2.1 Instructions on creating a namespace

创建命名空间相关说明:
1、一个账号最多可以创建 3 个命名空间

2、命名空间创建参考:
推荐创建的命名空间用来对应一个公司、组织或个人用户,例如AliyunObama。不推荐用来对应一个模块
或系统,例如TomcatCentOS,应用或模块推荐使用仓库进行管理。

3、定义您的镜像仓库命名空间,设置后不可修改。长度为2-30位,可填写小写英文字母、数字,可使用的分隔
符包括“_”、“-”(分隔符不能在首位或末位)

2.2 Click on the namespace in the lower right corner. Step 2

Insert image description here
Insert image description here

2.3 Create namespace-2023815_djc-Namespace creation reference

Insert image description here
Insert image description here
Created namespace-2023815_djc successfully
Insert image description here

2.4 Step 2 - Namespace - Creating the namespace is complete

Insert image description here

3. Create a mirror warehouse rep2023815

Note: The name of the image warehouse here, rep2023815 , is wrong. It is easy to distinguish the images, but the process and steps are fine. It is recommended to start reading directly from 4. The whole process of creating the image warehouse mysql and 5. Pushing the mysql image to the Registry-mirror warehouse mysql . Let’s look at 7. Summary and reduce wasted work.

3.1 Click on the mirror warehouse in the lower right corner. Step 3

Insert image description here

3.2 Click to create a mirror warehouse

Insert image description here
Insert image description here
Insert image description here

3.3 Select local repository for code source

Code Source Select a local repository . Images can be pushed to the mirror warehouse through the command line .
Insert image description here

3.4 Introduction to other code sources

3.4.1 Code source-Codeup introduction

Insert image description here

3.4.2 Code source-GitHub

Insert image description here

3.4.3 Code source-Bitbucket

Insert image description here

3.4.4 Code Source-Private GitLab

Insert image description here

3.4.5 Code source-local repository

Insert image description here

3.5 Select the local warehouse for the code source - the mirror warehouse rep2023815 was created successfully

Insert image description here

3.5.1 Warehouse rep2023815-Basic Information-Operation Guide

Insert image description here

3.5.2 Mirror warehouse rep2023815-Basic information-Product description

Insert image description here

3.6 Mirror warehouse rep2023815-trigger

Insert image description here

3.7 Warehouse rep2023815-mirror version

Insert image description here

3.8 Push the jdk11 image to the Registry-mirror warehouse rep2023815

docker login --username=djcking2020 registry.cn-hangzhou.aliyuncs.com
//输入之前设置的密码  
docker tag 526230ab6ddf registry.cn-hangzhou.aliyuncs.com/2023815_djc/rep2023815:11

docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/rep2023815:11

Insert image description here
Insert image description here
Insert image description here

3.9 Push the nginx image to Registry-mirror warehouse rep2023815

docker login --username=djcking2020 registry.cn-hangzhou.aliyuncs.com 
输入之前设置的密码  

docker tag 0e901e68141f registry.cnhangzhou.aliyuncs.com/2023815_djc/rep2023815:v1.21.6   

docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/rep2023815:v1.21.6

3.10 Push the mysql8.0.31 image to Registry-mirror warehouse rep2023815

//1-登录  在终端中输入访问凭证,登录Registry实例 
docker login --username=djcking2020 registry.cn-hangzhou.aliyuncs.com
输入之前设置的密码  

//2-tag
//docker images
//mysql        8.0.31          484689f290f   8 months ago    538MB
//docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/2023815_djc/rep2023815:[镜像版本号]
docker tag  7484689f290f  registry.cn-hangzhou.aliyuncs.com/2023815_djc/rep2023815:v8.0.31       


3-push
//docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/rep2023815:[镜像版本号]
docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/rep2023815:v8.0.31    


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

3.12 Mirror warehouse overview

Insert image description here

Insert image description here
Note: The name of the image warehouse here, rep2023815 , is wrong. It is easy to distinguish the images, but the process and steps are fine. It is recommended to start reading directly from 4. The whole process of creating the image warehouse mysql and 5. Pushing the mysql image to the Registry-mirror warehouse mysql . Let’s look at 7. Summary and reduce wasted work.

4. The entire process of creating a mirror warehouse mysql

4.1 Home page

Insert image description here

4.2 Click on the management console

Insert image description here

4.3 Enter the instance list

Insert image description here
Insert image description here

4.4 Click to enter the mirror warehouse

Insert image description here
Insert image description here

4.5 Click to create a mirror warehouse

Insert image description here

Click "Next"
Insert image description here
Insert image description here

4.6 Mirror warehouse mysql-basic information

When prompted, click "Add warehouse successfully"
Insert image description here

4.6.1 Mirror warehouse mysql-basic information-operation guide

Insert image description here

操作指南 

1. 登录阿里云Docker Registry
$ docker login --username=djcking2020 registry.cn-hangzhou.aliyuncs.com
用于登录的用户名为阿里云账号全名,密码为开通服务时设置的密码。
//输入之前设置的密码 
您可以在访问凭证页面修改凭证密码。

2.Registry中拉取镜像
$ docker pull registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:[镜像版本号]

3. 将镜像推送到Registry
$ docker login --username=djcking2020 registry.cn-hangzhou.aliyuncs.com
$ docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:[镜像版本号]
$ docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:[镜像版本号]
请根据实际镜像信息替换示例中的[ImageId][镜像版本号]参数。

4. 选择合适的镜像仓库地址ECS推送镜像时,可以选择使用镜像仓库内网地址。推送速度将得到提升并且将不会损耗您的公网流量。

如果您使用的机器位于VPC网络,请使用 registry-vpc.cn-hangzhou.aliyuncs.com 作为Registry的域名登录。

5. 示例
使用"docker tag"命令重命名镜像,并将它通过专有网络地址推送至Registry

$ docker images
REPOSITORY                                                         TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
registry.aliyuncs.com/acs/agent                                    0.7-dfb6816         37bb9c63c8b2        7 days ago          37.89 MB
$ docker tag 37bb9c63c8b2 registry-vpc.cn-hangzhou.aliyuncs.com/acs/agent:0.7-dfb6816
使用 "docker push" 命令将该镜像推送至远程。

$ docker push registry-vpc.cn-hangzhou.aliyuncs.com/acs/agent:0.7-dfb6816

4.6.2 Mirror warehouse mysql-basic information-product description

Insert image description here

4.7 You can view the newly created mysql mirror warehouse in the mirror warehouse.

Insert image description here

5. Push the mysql image to the Registry-mirror warehouse mysql

5.1 Push the image to Registry-Operation Guide

Refer to point 3 in 4.6.1 Warehouse MySQL-Basic Information-Operation Guide .

3. 将镜像推送到Registry
docker login --username=djcking2020 registry.cn-hangzhou.aliyuncs.com
输入之前设置的密码 

docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:[镜像版本号]

docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:[镜像版本号]
请根据实际镜像信息替换示例中的[ImageId][镜像版本号]参数。

5.2 docker images Check the image information that needs to be uploaded for push

IMAGE ID and image version number (TAG)

Please replace the [ImageId] and [Image Version Number] parameters in the example based on actual image information.

Insert image description here

5.3 Push the mysql image to Registry-mirror warehouse mysql

5.3.1 Push the mysql image to the Registry-mirror warehouse mysql-command

3. 将镜像推送到Registry
//1-login
docker login --username=djcking2020 registry.cn-hangzhou.aliyuncs.com
输入之前设置的密码  
//2-tag
//这个命令并没有推送镜像,只是给镜像指定一个版本,这个版本不是指本地镜像的版本,而是推送后在阿里云仓库的版本。
docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:[镜像版本号]
//3-push
docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:[镜像版本号]


-----------

//1-login
//连续上传,只需要登录一次
docker login --username=djcking2020 registry.cn-hangzhou.aliyuncs.com
输入之前设置的密码  

-------------mysql 8.0.29-----------------------
//2-tag
docker tag 33037edcac9b  registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:8.0.29  
//3-push
docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:8.0.29  


-------------mysql 8.0.31-----------------------
//2-tag
docker tag 7484689f290f  registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:8.0.31  
//3-push
docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:8.0.31 

【说明】:
docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:[镜像版本号]
这个命令并没有推送镜像,只是给镜像指定一个版本,这个版本不是指本地镜像的版本,而是推送后在阿里云仓库的版本。

//tag后面的是你要推送的镜像id
//后面是你的镜像仓库地址,直接去创建好的仓库去复制 

5.3.2 Push the mysql image to Registry-mirror warehouse mysql-screenshot

Insert image description here

Digest:该镜像的摘要信息。当您下载镜像时,最后一行中会出现这个值。

镜像ID: 使用1.10以上版本的客户端推送、拉取镜像时,这个值在客户端和服务端能够保持一致。否则这个值
将是随机的不予提供。

5.4 Some problems with pushing mysql8.0.31 to Registry-mirror warehouse mysql

The mirror warehouse rep2023815 also pushed an image of mysql8.0.31. See 3.10 to push the mysql8.0.31 mirror to the Registry-mirror warehouse rep2023815 .
Insert image description here

5.5 Push the mysql image to the Registry-mirror warehouse mysql and use docker images again

It is found that after pushing to the Registry, a mirror with the same IMAGE ID will be generated locally , as shown in the figure below.
Insert image description here

5.6 Enter the Alibaba Cloud Image Warehouse to view the mysql image pushed to the Registry (mirror warehouse mysql)

Insert image description here
Click on the mysql mirror warehouse and click on the mirror version
Insert image description here

6. Push the JDK11 image that was previously built manually using dockerfile to the Registry-mirror warehouse jdk

See the article Using dockerfile to manually build a JDK11 image, run the container and verify it

3. 将镜像推送到Registry
docker login --username=djcking2020 registry.cn-hangzhou.aliyuncs.com
输入之前设置的密码  
//docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/2023815_djc/jdk:[镜像版本号]
docker tag 526230ab6ddf  registry.cn-hangzhou.aliyuncs.com/2023815_djc/jdk:11

//docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/jdk:[镜像版本号]
docker push registry.cn-hangzhou.aliyuncs.com/2023815_djc/jdk:11

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

6.1 Create mirror warehouse jdk

Insert image description here
Insert image description here

6.2 jdk mirror warehouse-local warehouse-basic information-operation guide

Insert image description here
docker images
Here you can see that there are two local images with the same IMAGE ID. Both TAGs are 11. One isbuiltusing the docker build -t java:11. command in using dockerfile to manually build the JDK11 image and run the container and verify it . The other one is to push the jdk11 image to the Registry in 3.9 - after pushing the image warehouse rep2023815 to the rep2023815 image warehouse, a mirror with the same IMAGE ID will be generated locally

Insert image description here

6.3 Push the jdk image to the Registry-image warehouse jdk screenshot

Insert image description here
It can be found that the information displayed here is different from the information displayed after the normal push to the warehouse is successful . Mounted from 2023815_djc/rep2023815 is displayed here.

1、此时rep2023815和jdk这两个镜像仓库相同的是中都推送了jdk11这个镜像,并且IMAGE IDTAG都相同。

2、但是rep2023815镜像仓库中的REPOSITORY就是registry.cnhangzhou.aliyuncs.com/2023815_djc/rep2023815,
而且还存放了mysql8.0.31的镜像。

3、jdk镜像仓库的推送的jdk的REPOSITORY是registry.cn-hangzhou.aliyuncs.com/2023815_djc/jdk,只存放了jdk这一种镜像。

Therefore, the MOUNTED FROM 2023815_DJC /REP2023815 shown here should be the mirror warehouse of JDK11 mirror with the same iMage ID of the same image ID ( 3.9 to push the JDK11 image to the REP. Gistry-mirror warehouse rep2023815 ), directly The jdk11 image is synchronized to the image warehouse jdk , so the display is different from the normal push.
Insert image description here

6.4 Mirror warehouse jdk

Insert image description here
The jdk11 image just pushed to the Registry-mirror warehouse jdk
Insert image description here

6.5 Mirror warehouse jdk-security scan

Insert image description here

6.6 Mirror warehouse jdk-mirror layer information

You will find that the image layer information here is roughly the same as the content of the dockerfile file when we use dockerfile to manually build the JDK11 image, run the container and verify it .
Insert image description here

7. Summary

docker images 各参数说明:
REPOSITORY:表示镜像的仓库源名
TAG:镜像的标签或版本
IMAGE ID:镜像ID
CREATED:镜像创建时间
SIZE:镜像大小

1、同一镜像仓库源可以有多个 TAG,代表这个仓库源的不同个版本,如 jdk仓库源里,有 111213....20 等多个不同的版本,我们使用 REPOSITORY:TAG 来定义并区分不同的镜像,例如jdk:11,jdk:12,jdk:13,jdk:20等。

2、所以一个镜像仓库只存放一种镜像,镜像仓库名要见名知意,如镜像仓库jdk,就知道这个镜像仓库存放的是jdk11版本。
registry.cn-hangzhou.aliyuncs.com/2023815_djc/jdk:11 

如镜像仓库mysql,就知道这个镜像仓库存放的是mysql:8.0.29和mysql:8.0.31 
这两个版本。
registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:8.0.29
registry.cn-hangzhou.aliyuncs.com/2023815_djc/mysql:8.0.31 
如图一、图二所示。



3、所以rep2023815中存放了好几种镜像,mysql,jdk,nginx,是错误的存放方式,容易无法区分镜像,如图一、图二所示。
//jdk  
registry.cn-hangzhou.aliyuncs.com/2023815_djc/rep2023815:11
//mysql
registry.cn-hangzhou.aliyuncs.com/2023815_djc/rep2023815:v8.0.31  
//nginx
registry.cn-hangzhou.aliyuncs.com/2023815_djc/rep2023815:v1.21.6



4、所以镜像仓库名一般写成应用名就可以了,如mysql,oracle,jdk等。

5、发现推送到Registry(某镜像仓库)后会在本地也生成一个相同IMAGE ID的镜像,如图一、图二所示。

7.1 Figure 1 is as follows

Insert image description here

7.2 Figure 2 is as follows

Figure 1

8. Announcement related to product function adjustment of container image service ACR Personal Edition (August 20, 2023)

Container Image Service ACR Personal Edition Product Function Adjustment Announcement Update time: 2023-06-26 14:25
Dear Alibaba Cloud Container Image Service ACR users:
Container Image Service ACR plans to cancel Container Image Service ACR Personal from August 20, 2023 version of the image security scanning and image synchronization functions. If there are requirements for image security and efficient cross-regional image distribution, it is recommended to plan in advance to migrate to the Container Image Service ACR Enterprise Edition instance. For specific operations, see Personal Edition Migration.

Changes:
Starting from August 20, 2023, the image security scanning and image synchronization functions of the Container Image Service ACR Personal Edition will no longer support initiating new tasks, and all completed tasks will no longer support querying the task status and details. Please pay attention to the content of this product change in time to avoid affecting your subsequent use. Thank you for your cooperation.

Insert image description here2023-8-18 05:27:45
Personal version migration
accesses VPC service-associated role
Personal version instance image is imported to Enterprise version instance
Use personal version domain name to access Enterprise version instance

[Reprinted from aliyun official-Container Image Service ACR] Docker FAQs:
Manually build JDK11 image using dockerfile, run the container and verify it

Guess you like

Origin blog.csdn.net/qyfx123456/article/details/132353051