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. It is suitable for large-scale business deployment. This topic describes how to use a Container Registry Enterprise Edition instance to push and pull images.

Prerequisites

  • Object Storage Service (OSS) on which Container Registry Enterprise Edition depends is activated. For more information, see Activate OSS.

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

If 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 an image repository before you can push and pull images.

  1. Log on to the Container Registry console.
  2. Click Reset Docker Login Password.
    Note If you forget the logon password for the image registry, you can use an access credential to log on to image repositories. For more information, see Configure an access credential.
  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 top navigation bar, select a region.
  3. In the left-side navigation pane, click Instances.
  4. On the Instances page, click Create Instance.
  5. In the Create Instance dialog box that appears, configure the basic information.
    1. Enter an instance name.
    2. Select an instance type. For more information, see What is Container Registry Enterprise Edition?.
    3. Read and select the check box for Please Read and Accept the Beta Agreement of Container Registry Enterprise Edition.

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 Repositories > Namespaces in the left-side navigation pane.
  6. On the Namespaces page, click Create Namespace.
  7. In the Create Namespace dialog box, set the Namespaces, Automatically Create Repository, and Default Repository Type parameters. Click Confirm.

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 Repositories > Repositories in the left-side navigation pane.
  6. On the Repositories page, click Create Repository.
  7. In the Repository Info step, set the Namespaces, Repository Name, Repository Type, Tags, Summary, and Description parameters, and click Next.
    Note If you select Immutable next to Tags, all images except for those with the latest tag in the repository cannot be overwritten. After you set an image tag as immutable, you can rely on the tag to correlate the deployed image version with the build that produced the image.
  8. In the Code Source step, set the Code Source, Build Settings, and Build Rules parameters, and click Create Repository.
    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 Build a repository and images.

Step 6: Push and pull an image

  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 public network.
  2. Run the following command to log on to the image repository:
    sudo docker login --username=<Registry logon name> <Image repository name>-registry.cn-<The region where the Container Registry Enterprise Edition instance resides>.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:
      sudo docker tag <ImageId> registry.cn-hangzhou.aliyuncs.com/devopes-***/m**:[Image tag]
      • ImageId: the ID of the image.
      • registry.cn-hangzhou.aliyuncs.com/devopes-***/m**: the address of the image repository.
    2. Run the following command to push the image to the default instance:
      sudo docker push registry.cn-hangzhou.aliyuncs.com/devopes-***/m**:[Image tag]
      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:
    sudo docker pull registry.cn-hangzhou.aliyuncs.com/devopes-***/m**:[Image tag]
    Run the docker images command. If the image appears in the command output, the image is pulled from the image repository.