All Products
Search
Document Center

Container Registry:Replicate images between instances that belong to the same account

Last Updated:Feb 02, 2024

If you want to replicate container images between instances across regions, you can configure replication rules to replicate images from a source instance to a destination instance.

Prerequisites

The source instance must be of the Advanced Edition. The destination instance can be of the Basic Edition or Advanced Edition.

Note
  • If your Container Registry Enterprise Edition instance is of the Basic Edition, you can click Upgrade in the card of the instance to upgrade the instance to the Advanced Edition.

  • You cannot replicate images from a public cloud region to a non-public cloud region, such as an Alibaba Finance Cloud region or an Alibaba Gov Cloud region.

Automatically replicate images

You can configure a replication rule to automate image replication between instances that belong to the same account. After you push an image to the source instance, the system automatically replicates the image to the destination instance.

Important

Only images that are pushed after the replication rule is configured can be automatically replicated between instances that belong to the same account. Existing images cannot be replicated. For more information about how to replicate existing images, see Manually replicate images and CreateRepoSyncTask.

New images can be automatically replicated between instances that belong to the same account by namespace or image repository.

  • To automate image replication by namespace, the destination instance and the source instance must share a namespace and automatic repository creation is configured for the namespace.

  • To automate image replication by image repository, the destination instance and the source namespace must share a namespace and 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 Enterprise Edition instance that you want to manage.

  5. In the left-side navigation pane of the management page of the Enterprise Edition instance, choose Distribution > Instance Replication. On the page that appears, click Create Rule.

  6. In the Instance Information step of the Create Rule wizard, configure parameters and then click Next. The following table describes the parameters.

    Note

    You cannot specify the source instance in a replication rule as the destination instance in another replication rule. You cannot specify the destination instance in a replication rule as the source instance or destination instance in another replication rule. For example, you specify Instance A as the source instance when you create a replication rule. When you create another replication rule, you can specify Instance A as the source instance instead of the destination instance.

    Parameter

    Description

    Rule Name

    Enter a name for the replication rule.

    Replication Scenario

    Select Same Account.

    Destination Instance

    Select the region where the destination instance resides, and then select the destination instance.

    Note

    Images can be automatically replicated across regions when Internet access is disabled. This prevents security risks that are caused by Internet access.

  7. In the Replication Information step of the Create Rule wizard, configure parameters and then click Create Rule. The following table describes the parameters.

    Parameter

    Description

    Replication Level

    Select Namespace or Repository based on your requirements.

    Source Address

    • If you set the Replication Level parameter to Namespace, select a namespace and enter the regular expression that is used to filter image tags.

    • If you set the Replication Level parameter to Repository, select the namespace and repository in which the images to be replicated reside, and enter a regular expression that is used to filter image tags.

    A replication task is automatically triggered when a new image is pushed to the repository that matches the created replication rule.

    In the left-side navigation pane of the management page of the instance, choose Distribution > Replication Record. On the page that appears, you can view replication tasks.

Manually replicate images

You can configure a replication rule to manually replicate images between instances that belong to the same account.

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

  5. In the left-side navigation pane of the management page of the Enterprise Edition instance, choose Repository > Repositories.

  6. On the Repositories page, click the name of the repository in which the images to be replicated reside.

  7. In the left-side navigation pane of the details page of the image repository, click Tags. On the page that appears, find the image that you want to replicate and click Replicate in the Actions column that corresponds to the image.

  8. In the Image Replication dialog box, set Replication Scenario to Same Account, select the region where the destination instance resides and select the name and namespace of the destination instance. Enter the name of the destination repository and the image tag, specify whether to overwrite the existing image that has the same name as the pushed image, and then click OK.

    In the left-side navigation pane of the management page of the Container Registry Enterprise Edition instance, choose Distribution > Replication Record. On the Replication Record page, the status of the replication task is displayed as Completed. If the manual replication is successful, the image appears in the destination instance.

References

If you want to replicate images across Alibaba Cloud accounts, see Replicate images between instances that belong to different accounts.