All Products
Search
Document Center

Container Registry:Build repositories and images

Last Updated:Jun 21, 2026

This topic describes how to create an image repository, configure build rules, and build images using a Personal Edition instance.

Usage notes

Note

The image build timeout for a Personal Edition instance is 30 minutes. If you require advanced features, such as flexible build configurations, custom build parameters, and multi-architecture builds, we recommend using an Enterprise Edition instance to build images. For more information, see Build images by using an Enterprise Edition instance.

Before building images with a Personal Edition instance, ensure the base image in your Dockerfile meets the following requirements:

  • You can use any public images that do not require authorization.

  • You can use private images from the same account and in the same region as the Personal Edition instance.

  • You cannot use private images from a different region.

  • You cannot use VPC images from any region.

  • You cannot use third-party licensed images.

For example, the base image in your Dockerfile can be a public image, but it cannot be a third-party licensed image.

Features

Note

To use the build feature, you must bind a source code repository to your Personal Edition instance. You can do this after you create the instance.

  • Automated builds on code changes

    When you enable Automatically Build Images When Code Changes, Container Registry automatically builds an image every time you commit code. This eliminates the need for manual builds.

    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 Personal Edition instance that you want to manage.

    5. In the navigation pane on the left, choose Repository > Repositories.

    6. On the Repositories page, find the target repository and click Manage in the Actions column.

    7. In the navigation pane on the left, click Build, and then turn on the Automatically Build Images When Code Changes switch.

    Build settings also include the Overseas build and Build without cache switches, both of which are disabled by default.

  • Overseas build

    During the build process, your code may depend on sources outside mainland China. For this scenario, Container Registry provides the Build with Servers Deployed Outside Chinese Mainland feature. After the build completes on an overseas machine, the image is pushed to the repository in your specified region.

    Note

    Unstable network connections from overseas locations to mainland China can cause the image push to time out and fail.

  • Build without cache

    If you enable Build Without Cache, the build process pulls the base image every time, ignoring any cached layers. This can increase build times, so we recommend keeping this option disabled.

  • Multi-stage build

    Container Registry also supports multi-stage builds.

Step 1: Bind a code source

This section uses GitHub as an example to demonstrate binding a code source. For information about how to bind other code sources, see Connect to a source code hosting platform.

Important

To access a private GitLab instance in a VPC, see Build container images with VPC secure build mode.

  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 Personal Edition instance that you want to manage.

  5. In the navigation pane on the left, choose Repository > Code Source.

  6. On the Code Source page, find GitHub and click Bind Account in the Actions column.

  7. In the GitHub dialog box, click Go to the source code repository to bind account.

  8. On the GitHub page, enter your username and password, and then click Sign in.

    You are redirected to the Container Registry console, and the message You have successfully bound the GitHub account appears.

Step 2: Create an image repository

Before creating an image repository, you must have a namespace in the desired region. For more information, see Manage namespaces.

  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 Personal Edition instance that you want to manage.

  5. In the navigation pane on the left, choose Repository > Repositories.

  6. On the Repositories page, click Create Repository.

  7. In the Repository Info step of the wizard, configure Namespace, Repository Name, Summary, and Repository Type. In this example, select Private for the repository type. Then, click Next.

    Note

    The image build feature is not supported for local repositories.

  8. In the Code Source step of the wizard, configure Code Source, Build Settings, and Build Rules, and then click Create Repository.

    Parameter

    Description

    Code Source

    Select a code source. This example uses GitHub. Click GitHub, and then select a namespace and repository.

    Build Settings

    • Automatically build images upon code changes: Triggers the build rule when you commit code to a branch.

    • Overseas build: Builds images in an overseas data center and pushes them to the specified region. If your build task involves resources in mainland China, such as the source code repository and the image repository, we recommend disabling Build with Servers Deployed Outside Chinese Mainland and using a build server in mainland China.

    • Build without cache: Forces a re-pull of the base dependency images for each build, which may increase the build time. Disabling the Build Without Cache option accelerates image builds.

Step 3: Set build rules

Note

If Build is not displayed on the management page of your image repository, the code source is not bound correctly. See Step 1 to bind it again.

  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 Personal Edition instance that you want to manage.

  5. In the navigation pane on the left, choose Repository > Repositories.

  6. On the Repositories page, find the target repository and click Manage in the Actions column.

  7. In the navigation pane on the left, click Build. In the Build Rules section, click Add Build Rule.

    Note

    To modify a build rule, find the target rule and click Modify in the Actions column.

  8. In the Add Build Rule dialog box, set the build rule parameters, and then click Confirm.

    Parameter

    Description

    Type

    The type of source to build from. Valid values: Branch and Tag.

    Branch/Tag

    The code branch or tag to use for the build.

    Build Context Directory

    The path to the directory containing the Dockerfile, relative to the root of the specified branch or tag. For example, if your Dockerfile is in the root directory of the master branch, set this parameter to ./.

    Dockerfile Filename

    The name of the Dockerfile. The default value is Dockerfile.

    Image Version

    The tag for the built image, such as latest.

Step 4: Build an image

  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 Personal Edition instance that you want to manage.

  5. In the navigation pane on the left, choose Repository > Repositories.

  6. On the Repositories page, find the target repository and click Manage in the Actions column.

  7. In the navigation pane on the left, click Build.

  8. In the Build Rules section, find the target rule and click Build in the Actions column.

    When the build completes, a new build record is generated.

    Note

    To view build logs, click Log in the Actions column of the build record.

  9. After the build completes, click Image Version in the navigation pane on the left to view the built images.

  10. To view all images, click Build in the navigation pane on the left. In Build Settings, enable Build with Servers Deployed Outside Chinese Mainland and Build Without Cache. Automatically Build Images When Code Changes is enabled by default. Then click Image Version in the navigation pane on the left to view all image tags.

Next steps