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.
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.
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.
Two solutions can be used to replicate existing images:
If you do not have a large number of existing images, you can manually replicate the images. For more information, see Manually replicate images and CreateRepoSyncTask.
If you have a large number of existing images, we recommend that you use the combination solution of replicating images to OSS buckets and importing Container Registry images.
Copy all files in an OSS bucket to the OSS bucket of a Container Registry instance. For more information, see Data replication.
Create an import rule, select an OSS bucket as the migration source, and start an image import task.
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.
Log on to the Container Registry console.
In the top navigation bar, select a region.
In the left-side navigation pane, click Instances.
On the Instances page, click the Enterprise Edition instance that you want to manage.
In the left-side navigation pane of the management page of the Enterprise Edition instance, choose . On the page that appears, click Create Rule.
In the Instance Information step of the Create Rule wizard, configure parameters and then click Next. The following table describes the parameters.
NoteYou 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.
NoteImages can be automatically replicated across regions when Internet access is disabled. This prevents security risks that are caused by Internet access.
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
. 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.
Log on to the Container Registry console.
In the top navigation bar, select a region.
In the left-side navigation pane, click Instances.
On the Instances page, click the Enterprise Edition instance that you want to manage.
In the left-side navigation pane of the management page of the Enterprise Edition instance, choose .
On the Repositories page, click the name of the repository in which the images to be replicated reside.
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.
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
. 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.