You can configure replication rules to replicate images from a source instance to a destination instance. This allows you to replicate images between instances that reside in different regions. This topic describes how to manually and automatically replicate images between instances that belong to the same Alibaba Cloud account.

Prerequisites

The source instance is a Container Registry Advanced Edition instance. You cannot replicate images from a Container Registry Basic Edition instance. The destination instance can be a Container Registry Basic Edition or an Advanced Edition instance.
Note To upgrade a Container Registry Enterprise Edition instance, find the instance on the Instances page and click Upgrade in the lower-right corner.

Automatically replicate images

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

Important Only images that are uploaded after the replication rule is configured can be automatically replicated between instances that belong to the same account. Preexisting images cannot be replicated. For information about how to replicate preexisting images between instances that belong to the same account, 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 implement automatic image replication by namespace, the destination instance must have a namespace that has the same name as the source namespace and can automatically create repositories.
  • To implement automatic image replication by image repository, the destination instance must have a namespace that has the same name as the source namespace, and must have an image repository that has the same name as the source 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 required Container Registry Enterprise Edition instance.
  5. In the left-side navigation pane of the management page of your Container Registry 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 the parameters and 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 cannot specify Instance A as the destination instance. However, you can specify Instance A as the source 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 the parameters and then click Create Rule. The following table describes the parameters.
    Parameter Description
    Replication Level Images can be replicated by namespace or image repository.
    Source Address
    • If you set the Replication Level parameter to Namespace, select a namespace and enter the regular expression for image tags.
    • If you set the Replication Level parameter to Repository, select a namespace, enter the name of the repository, and then enter the regular expression for image tags.

    A replication task is automatically triggered when a new image is uploaded to the repository whose name 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 required Container Registry Enterprise Edition instance.
  5. In the left-side navigation pane of the Instance of Enterprise Edition page, choose Repository > Repositories.
  6. On the Repositories page, click the name of the repository that you want to manage.
  7. In the left-side navigation pane of the repository details page, click Tags. Find the image that you want to replicate and click Sync in the Actions column.
  8. In the Image Replication dialog box, set the Replication Scenario parameter to Same Account. Select the region where the destination instance resides, and then select the destination instance. Select a namespace and enter the name of the destination repository and the image tag. Specify whether to overwrite the existing image of the same name, 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.