Container Registry Enterprise Edition is an enterprise-class platform designed to manage the lifecycle of cloud-native application artifacts, including container images, Helm charts, and Open Container Initiative (OCI) artifacts. You can manage images in a Container Registry Enterprise Edition instance to facilitate application creation by using images. This topic describes how to use a Container Registry Enterprise Edition instance to push and pull images.

Prerequisites

Step 1: Obtain the logon name of the image registry

  • If you use an Alibaba Cloud account, the Alibaba Cloud account is the logon name of the image registry.
  • If you use a RAM user, the string before .onaliyun.com is the logon name of the image registry. For example, if your RAM user is 123@1880770869021234.onaliyun.com, the logon name of the image registry is 123@1880770869021234.

Step 2: Set a logon password for the image registry

When you log on to the Container Registry console for the first time, you must set a logon password for the image registry. You must use this password to log on to the image registry before you can push and pull images.
Note If it is not the first time that you log on to the Container Registry console and you forget the logon password for the image registry, you can configure an access credential. For more information, see Configure an access credential.
  1. Log on to the Container Registry console.
  2. Click Reset Docker Login Password.
  3. In the Reset Docker Login Password dialog box, set the Password and Confirm Password parameters and click Confirm.

Step 3: Create a Container Registry Enterprise Edition instance

  1. Log on to the Container Registry console.
  2. In the left-side navigation pane, click Instances.
  3. On the Instances page, click Create ACR EE.
  4. On the Container Registry Enterprise Edition page, configure the basic information and click Buy Now.
    Parameter Description
    Region The region where the Container Registry Enterprise Edition instance resides.
    Instance Type The type of the Container Registry Enterprise Edition instance. For more information, see What is Container Registry?.
    Instance Name The name of the instance.
    Instance Storage Valid values: Default and Custom.
    • Default: By default, an OSS bucket is created under your account to store container images.
    • Custom: You can select an existing OSS bucket to store container images.
    Select Bucket Select an existing OSS bucket to store container images.
    Note This parameter is displayed only when you set the Instance Storage parameter to Custom.
    Time Duration You can select one, two, three, or six months. If you require a longer duration, you can select one to five years.
    Note You can specify whether to enable auto-renewal.
  5. On the Confirm Order page, confirm the configurations, select I have read and agree to Container Registry Enterprise Edition Agreement of Service, and then click Pay.
  6. On the Purchase page, click Purchase.

    On the Instances page, the status of the new instance is Starting. The status changes to Running after about 10 seconds.

Step 4: Create a namespace

  1. Log on to the Container Registry console.
  2. In the top navigation bar, select a region.
  3. In the left-side navigation pane, click Instances.
  4. On the Instances page, click the Container Registry Enterprise Edition instance for which you want to create a namespace.
  5. On the management page of the Container Registry Enterprise Edition instance, choose Repository > Namespace in the left-side navigation pane.
  6. On the page that appears, click Create Namespace.
  7. In the Create Namespace dialog box, set the Namespace, Automatically Create Repository, and Default Repository Type parameters. Click OK.

Step 5: Create an image repository

  1. Log on to the Container Registry console.
  2. In the top navigation bar, select a region.
  3. In the left-side navigation pane, click Instances.
  4. On the Instances page, click the Container Registry Enterprise Edition instance for which you want to create an image repository.
  5. On the management page of the Container Registry Enterprise Edition instance, choose Repository > Repositories in the left-side navigation pane.
  6. On the Repositories page, click Create Repositories.
  7. In the Repository Info step, set the Namespace, Repository Name, Repository Type, Tags, Accelerated Image, Summary, and Description parameters, and click Next.
  8. In the Code Source step, set the Code Source, Build Settings, and Build Rules parameters, and click Create Repositories.
    Parameter Description
    Code Source The code source.
    Build Settings
    • Automatically Build Images When Code Changes: If you select this option, an image is automatically built when code is committed from a branch.
    • Build With Servers Deployed Outside Mainland China: If you select this option, images are built in a data center outside mainland China and then pushed to the image repository.
    • Build Without Cache: If you select this option, the system pulls the dependent base image for every image to be built. This may prolong the build time.
    Build Rules After the repository is created, you can go to the Build page to create build rules. For more information, see Create a repository and build images.

Step 6: Push and pull an image

The following commands must be run on the Docker client. Install and configure the Docker client in advance.

  1. Configure access control.
    • If you use a virtual private cloud (VPC), you must configure the access to the Container Registry Enterprise Edition instance over the VPC. For more information, see Configure access over VPCs.
    • If you use the Internet, you must configure the access to the Container Registry Enterprise Edition instance over the Internet. For more information, see Configure access over the Internet.
  2. Run the following command to log on to the image repository:
    docker login --username=<Image registry logon username> <Name of the Container Registry Enterprise Edition instance>-registry.cn-<Region where the Container Registry Enterprise Edition instance resides>.cr.aliyuncs.com
    Example:
     docker login --username=123@1880770869021234 m**-registry.cn-hangzhou.cr.aliyuncs.com

    At the command prompt, enter the logon password that is specified in Step 2: Set a logon password for the image registry. If login succeeded is displayed, the logon is successful.

  3. Push an image.
    1. Run the following command to tag the image:
      docker tag <Image ID> <Name of the Container Registry Enterprise Edition instance>-registry.cn-<Region where the Container Registry Enterprise Edition instance resides>.cr.aliyuncs.com/<Namespace>/<Image repository name>:<Image tag>
      Example:
      docker tag Digest m**-registry.cn-hangzhou.cr.aliyuncs.com/m**/test:latest
    2. Run the following command to push the image to the Container Registry Enterprise Edition instance:
      docker push <Name of the Container Registry Enterprise Edition instance>-registry.cn-<Region where the Container Registry Enterprise Edition instance resides>.cr.aliyuncs.com/<Namespace>/<Image repository name>:<Image tag>
      Example:
      docker push m**-registry.cn-hangzhou.cr.aliyuncs.com/m**/test:latest
      On the Repositories page, click the name of the image repository. On the page that appears, click Tags. If the image appears on the Tags page, the image is pushed to the image repository.
  4. Run the following command to pull an image:
    docker pull <Name of the Container Registry Enterprise Edition instance>-registry.cn-<Region where the Container Registry Enterprise Edition instance resides>.cr.aliyuncs.com/<Namespace>/<Image repository name>:<Image tag>
    Example:
    docker pull m**-registry.cn-hangzhou.cr.aliyuncs.com/m**/test:latest
    Run the docker images command. If the image appears in the command output, the image is pulled from the image repository.