Docker is a containerized application platform that lacks image hosting capabilities. By pushing Docker images to image repositories of Container Registry Personal Edition instances, you can utilize basic Container Registry features and image hosting capabilities. Other users can also pull your Docker images from these repositories.
Prerequisites
-
To create a Container Registry Personal Edition instance, follow the link.
-
To install Docker, see the referenced document.
-
You can either bind a source code hosting platform or build an image locally. For more information, see how to build and push multi-architecture images to Container Registry.
Step 1: obtain the username that you use to log on to the Container Registry Personal Edition instance
You can log on to Container Registry console, and select to obtain the username. on the Personal Edition instance management page
-
If you are using an Alibaba Cloud account, the account name is your username for logging on to the Container Registry Personal Edition instance.
-
If you are using a RAM user, the username is the RAM user account name without the suffix onaliyun.com. For example, if your RAM user account is XXX@10051309672****.onaliyun.com, the username is XXX@10051309672****.
Step 2: Set a password that you use to log on to the Container Registry Personal Edition instance
First-time password setup
If it's your first time logging on to the Container Registry console, you must set a logon password for your Container Registry Personal Edition instance to facilitate image uploads and downloads.
Log on to the Container Registry console.
-
Click the Set A Registry Logon Password option.
-
In the Set A Registry Logon Password dialog box, enter the Password and Confirm Password , then click OK.
Reset password
If you forget the password you set, you can reset it using an access credential.
Log on to the Container Registry console.
In the top navigation bar, select a region.
In the left-side navigation pane, click Instances.
On the Instances page, click the Personal Edition instance that you want to manage.
-
On the Personal Edition instance management page, select
-
On the Access Credential page, you can click Set A Fixed Password and follow the instructions to reset the password.
NoteContainer Registry Personal Edition does not support the retrieval of temporary accounts and passwords for instance logon via GetAuthorizationToken. It is recommended to use a permanent password for logging on.
Step 3: Create a namespace
Namespaces allow you to manage a collection of repositories, such as managing permissions on repositories and modifying repository attributes.
Log on to the Container Registry console.
In the top navigation bar, select a region.
In the left-side navigation pane, click Instances.
On the Instances page, click the Personal Edition instance that you want to manage.
-
On the Personal Edition instance management page, select .
-
On the Namespace page, click Create Namespace.
-
In the Create Namespace dialog box, enter the namespace name and click OK .
Step 4: create an image repository
Log on to the Container Registry console.
In the left-side navigation pane, click Instances.
On the Instances page, click the Personal Edition instance that you want to manage.
-
On the Personal Edition instance management page, select .
-
On the Image Repository page, you can click Create Image Repository.
-
In the Repository Information configuration wizard, you can set the Namespace , Repository Name , Repository Type , Summary , and Description , then click Next.
NoteThe repository name must be 2 to 64 characters in length and can contain lowercase letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot start or end with an underscore (_) or contain forward slashes (/).
-
In the Code Source configuration wizard, configure the Code Source, Build Settings, and Build Rules, then click Create Image Repository.
Parameter
Description
Code Source
Select the code source.
ImportantBefore you select a code source, ensure that the instance is bound to a source code hosting platform. For more information, see Bind a source code hosting platform.
Build Settings
Automatically Build Images When Code Changes: When a branch has code committed, the build rule is automatically triggered.
Build On Machines Outside China: The build is performed in data centers outside China. After the build is successful, the image is pushed to the specified region.
Do Not Use Cache: Each build forces a re-pull of the base dependency image, which may increase the build time.
Build Rules
After you create the image repository, go to the image building page to create image building rules. For more information, see Build repositories and images.
Step 5: push and pull an image
Beginning September 9, 2024, the endpoint for the new Personal Edition instance will be adjusted. For more information, see Limits on the new Personal Edition instance. Depending on your needs, you can select various methods to push and pull images.
You may experience difficulties pulling images from outside China due to carrier network issues when utilizing the image accelerator feature. For more information, see [Product Change] Announcement on the adjustment of the ACR image accelerator feature.
Container Registry Personal Edition instance of the new version
-
You can log on to Container Registry console, and select to obtain the logon command. on the Personal Edition instance management page
To log on to the image repository, run the following command.
docker login --username=<username for logging on to the image repository> crpi-xxxx.cn-<region of the Personal Edition instance>.personal.cr.aliyuncs.com
Enter the password you established in Step 2: Set a password for logging on to the Container Registry Personal Edition instance as shown in the result. If
login succeeded
is displayed, the logon has been successful. -
Push an image to the repository.
-
To tag the image, run the following command.
docker tag <image ID> crpi-xxxx.cn-<region of the Personal Edition instance>.personal.cr.aliyuncs.com/<namespace name>/<image repository name>:<image version number>
-
To push the image to the Personal Edition instance, run the following command.
docker push crpi-xxxx.cn-<region of the Personal Edition instance>.personal.cr.aliyuncs.com/<namespace name>/<image repository name>:<image version number>
On the Image Repository page, click the name of the target image repository and select Image Version. On the Image Version page, the presence of the pushed image confirms that the image has been successfully pushed.
-
-
Execute the command below to pull the image.
docker pull crpi-xxxx.cn-<region of the Personal Edition instance>.personal.cr.aliyuncs.com/<namespace name>/<image repository name>:<image version number>
Execute
docker images
. The displayed list of images will include the pulled image, confirming that it has been successfully retrieved.
Container Registry Personal Edition instance of the old version
-
To log on to the image repository, run the following command: You can log on to Container Registry console or , navigate to , and retrieve the logon command. on the Personal Edition instance management page
docker login --username=<username for logging on to the image repository> registry.cn-<region of the Personal Edition instance>.aliyuncs.com
Enter the password you established in Step 2: Set a password for logging on to the Container Registry Personal Edition instance when prompted. If
login succeeded
appears, the logon has been successful. -
Push an image to the repository.
-
To tag the image, run the following command.
docker tag <image ID> registry.cn-<region of the Personal Edition instance>.aliyuncs.com/<namespace name>/<image repository name>:<image version number>
-
To push the image to the Personal Edition instance, run the following command.
docker push registry.cn-<region of the Personal Edition instance>.aliyuncs.com/<namespace name>/<image repository name>:<image version number>
On the Image Repository page, click the name of the target image repository and select Image Version. On the Image Version page, you can view the pushed image, which confirms that the image has been successfully pushed.
-
-
To pull the image, run the following command.
docker pull registry.cn-<region of the Personal Edition instance>.aliyuncs.com/<namespace name>/<image repository name>:<image version number>
Execute
docker images
. If you see the pulled image in the results, it indicates a successful pull.
Related operations
Batch delete image versions
Log on to the Container Registry console.
In the top navigation bar, select a region.
In the left-side navigation pane, click Instances.
On the Instances page, click the Personal Edition instance that you want to manage.
-
On the Personal Edition instance management page, select , and click the name of the desired repository on the right side of the page.
-
In the left-side navigation pane on the image repository details page, click Image Version.
-
On the Image Version page, select the Version
Batch Delete icon on the left, and click it.
-
In the confirmation dialog box, select Confirm to Delete the Version of the Image, and click OK.