Container Registry Personal Edition provides basic image features, such as secure management of application images and image scanning that precisely detects vulnerabilities. This topic describes how to use a Container Registry Personal Edition instance to push and pull images.

Prerequisites

Step 1: Obtain the username that you use to log on to the Container Registry Personal Edition instance

  • If you use an Alibaba Cloud account, the name of the Alibaba Cloud account is the username used to log on to the Container Registry Personal Edition instance.
  • If you use a RAM user, the string before .onaliyun.com is the username used to log on to the Container Registry Personal Edition instance. For example, if the name of your RAM user is 123@1234567810111213.onaliyun.com, 123@1234567810111213 is the username used to log on to the Container Registry Personal Edition instance.

Step 2: Set a password that you use to log on to the Container Registry Personal Edition instance

If you are logging on to the Container Registry console for the first time, you must set a password that is used to log on to the Container Registry Personal Edition instance. Then, you can push and pull images in the console.

  1. Log on to the Container Registry console.
  2. Click Reset Docker Login Password.
    Note If you forget the password that you set, you can use an access credential to reset a password.
  3. In the Reset Docker Login Password dialog box, configure the Password and Confirm Password parameters and click Confirm.

Step 3: Create a namespace

You can manage a collection of repositories in a namespace. For example, you can manage permissions on repositories and modify repository attributes in a namespace.

  1. Log on to the Container Registry console.
  2. In the top navigation bar, select a region.
  3. On the Instances page, click the default instance.
  4. On the management page of the Container Registry Personal Edition instance, choose Repository > Namespace in the left-side navigation pane.
  5. On the Namespace page, click Create Namespace.
  6. In the Create Namespace dialog box, enter a name for the namespace and click Confirm.

Step 4: Create an image repository

  1. Log on to the Container Registry console.
  2. On the Instances page, click the default instance.
  3. On the management page of the Container Registry Personal Edition instance, choose Repository > Repositories in the left-side navigation pane.
  4. On the Repositories page, click Create Repository.
  5. In the Repository Info step of the Create Repository wizard, configure the Namespace, Repository Name, Repository Type, Summary, and Description parameters, and click Next.
    Note The 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 (/).
  6. In the Code Source step, configure the Code Source, Build Settings, and Build Rules parameters, and click Create Repository.
    Parameter Description
    Code Source The code source.
    Notice Before 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: If you select this option, Container Registry automatically builds an image 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 the Chinese mainland and then pushed to the image repository in the specified region.
    • Build Without Cache: If you select this option, the system pulls the dependent base image for each image to be built. This may slow down the build process.
    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 5: Push and pull an image

  1. Run the following command to log on to the Container Registry Personal Edition instance:
    docker login --username=<Username used to log on to the Container Registry Personal Edition instance> registry.cn-<Region ID of the Container Registry Personal Edition instance>.aliyuncs.com

    Enter the logon password that is set in Step 2: Set a password that you use to log on to the Container Registry Personal Edition instance as prompted. If login succeeded is displayed, the logon is successful.

  2. Push an image.
    1. Run the following command to tag the image:
      docker tag <Image ID> registry.cn-<Region ID of the Container Registry Personal Edition instance>.aliyuncs.com/<Name of the namespace>/<Name of the image repository>:<Image tag>
    2. Run the following command to push the image to the image repository on the Container Registry Personal Edition instance:
      docker push registry.cn-<Region ID of the Container Registry Personal Edition instance>.aliyuncs.com/<Name of the namespace>/<Name of the image repository>:<Image tag>
      On the Repositories page, click the name of the image repository. On the page that appears, click Tags. If the image is displayed on the Tags page, the image is pushed to the image repository.
  3. Run the following command to pull an image:
    docker pull registry.cn-<Region ID of the Container Registry Personal Edition instance>.aliyuncs.com/<Name of the namespace>/<Name of the image repository>:<Image tag>
    Run the docker images command. If the image is displayed in the command output, the image is pulled from the image repository.

Other operations

Delete multiple image tags at a time

  1. Log on to the Container Registry console.
  2. In the top navigation bar, select a region.
  3. On the Instances page, click the default instance.
  4. On the management page of the Container Registry Personal Edition instance, choose Repository > Repositories. Click the name of the image repository whose tags you want to delete.
  5. On the details page of the repository, click Tags in the left-side navigation pane.
  6. On the Tags page, select the tags that you want to delete and then select Batch Delete.
  7. In the dialog box that appears, select I am sure to delete the images of these tags and then click OK.