Docker is a containerization platform but does not provide native image hosting. You can push Docker images to a Container Registry (ACR) Personal Edition instance for basic container image services, secure image hosting, and to allow other users to pull the images.
Prerequisites
-
Docker and Docker Compose are installed.
-
A source code hosting platform is linked or an image is built locally. For more information, see Build and push a multi-architecture image to Container Registry from your computer.
Step 1: Get your registry username
Log in to the Container Registry console. On the management page of the Personal Edition instance, choose to get your username.
-
If you are using an Alibaba Cloud account, your account name is your registry username.
-
If you are using a RAM user, your registry username is the part of your RAM username before the
.onaliyun.comsuffix. For example, if your RAM user isXXX@10051309672****.onaliyun.com, your registry username isXXX@10051309672****.
Step 2: Set the registry login password
Reset password
If you forget your registry login password, you can reset it by setting a fixed password.
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 management page of the Personal Edition instance, choose .
-
On the Access Credentials page, click Set Password and follow the prompts to reset your password.
NoteContainer Registry Personal Edition does not support using the GetAuthorizationToken API operation to get a temporary username and password for instance login. We recommend that you use a fixed password to log in.
First-time password setup
If you are logging in to the Container Registry console for the first time, you must set a registry login password to push and pull images.
Log on to the Container Registry console.
On the Instances page, click the Personal Edition instance that you want to manage.
-
In the Tips dialog box, click Activate Now and then click Reset Docker Login Password.
-
In the Reset Docker Login Password dialog box, enter your password in the Password and Confirm Password fields, and then click Confirm.
Step 3: Create a namespace
You can use a namespace to manage a collection of image repositories, including their permissions and properties.
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 management page of the Personal Edition instance, choose .
-
On the Namespace page, click Create Namespace.
-
In the Create Namespace dialog box, enter a namespace name and click Confirm.
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 management page of the Personal Edition instance, choose .
-
On the Repositories page, click Create Repository.
-
In the Repository Info step, set Namespace, Repository Name, Repository Type, Summary, and Description. Then, click Next.
NoteThe repository name must be 2 to 64 characters in length. It can contain lowercase letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot start or end with an underscore and cannot contain forward slashes (/).
-
In the Code Source step, configure Code Source, Build Settings, and Build Rules. Then, click Create Repository.
Parameter
Description
Code Source
Select a code source.
ImportantBefore you select a code source, make sure that you have linked a source code platform. For more information, see Link a source code hosting platform.
Build Settings
-
Automatically Build Images When Code Changes: If you select this option, build rules are automatically triggered when code is committed to a branch.
-
Build with Servers Deployed Outside Chinese Mainland: If you select this option, images are built in a data center outside the Chinese mainland and then pushed to the specified region after a successful build.
-
Build Without Cache: If you select this option, the base dependency images are forcibly re-pulled for each build, increasing the build time.
Build Rules Setting
After creating the repository, go to the build page to configure build rules. For more information, see Build a repository and an image.
-
Step 5: Push and pull an image
Starting from September 9, 2024, the format of registry endpoints for new Personal Edition instances will change. For more information, see Usage notes for new Personal Edition instances. Choose a method to push and pull images based on your instance version.
Due to carrier network issues, pulling images from overseas registries by using the image accelerator feature may fail. For more information, see [Product Change] Announcement on adjustments to the ACR image accelerator feature.
New Personal Edition instances
-
Log in to the Container Registry console. On the management page of the Personal Edition instance, choose to get the login command.
Run the following command to log in to the image repository.
docker login --username=<registry-username> crpi-xxxx.cn-<region-of-your-instance>.personal.cr.aliyuncs.comWhen prompted, enter the password that you set in Step 2: Set the registry login password. A
login succeededmessage indicates a successful login. -
Push the image.
-
Run the following command to tag the image.
docker tag <image-ID> crpi-xxxx.cn-<region-of-your-instance>.personal.cr.aliyuncs.com/<namespace-name>/<image-repository-name>:<tag> -
Run the following command to push the image to your Personal Edition instance.
docker push crpi-xxxx.cn-<region-of-your-instance>.personal.cr.aliyuncs.com/<namespace-name>/<image-repository-name>:<tag>On the Repositories page, click the name of the target repository, and then select Image Version. If you can see the pushed image on the Image Version page, the push was successful.
-
-
Run the following command to pull the image.
docker pull crpi-xxxx.cn-<region-of-your-instance>.personal.cr.aliyuncs.com/<namespace-name>/<image-repository-name>:<tag>Run the
docker imagescommand. If the pulled image appears in the command output, the pull was successful.
Old Personal Edition instances
-
Run the following command to log in to the image repository. To get the login command, log in to the Container Registry console and on the management page of the Personal Edition instance, choose .
docker login --username=<registry-username> registry.cn-<region-of-your-instance>.aliyuncs.comWhen prompted, enter the password that you set in Step 2: Set the registry login password. A
login succeededmessage indicates a successful login. -
Push the image.
-
Run the following command to tag the image.
docker tag <image-ID> registry.cn-<region-of-your-instance>.aliyuncs.com/<namespace-name>/<image-repository-name>:<tag> -
Run the following command to push the image to your Personal Edition instance.
docker push registry.cn-<region-of-your-instance>.aliyuncs.com/<namespace-name>/<image-repository-name>:<tag>On the Repositories page, click the name of the target repository, and then select Image Version. If you can see the pushed image on the Image Version page, the push was successful.
-
-
Run the following command to pull the image.
docker pull registry.cn-<region-of-your-instance>.aliyuncs.com/<namespace-name>/<image-repository-name>:<tag>Run the
docker imagescommand. If the pulled image appears in the command output, the pull was successful.
Related operations
Batch delete image tags
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 management page of the Personal Edition instance, choose , and then click the name of the target repository.
-
In the navigation pane on the left of the repository details page, click Image Version.
-
On the Image Version page, select the
icon to the left of the Tag, and click Batch Delete. -
In the confirmation dialog box, select I am sure to delete the images of these tags and click Confirm.