Migrating Self-built Harbor to Cloud Container Repository Enterprise Edition

2024-11-07 07:03:43

Scenario

For users who store container images using self-built Harbor, you can migrate to the Cloud Container Repository Enterprise Edition through the open-source image migration tool image-syncer.

Before You Begin

        An instance of the Cloud Container Repository Enterprise Edition has been activated

Procedure

1.      Download and unzip the image-syncer.

wget https://github.com/AliyunContainerService/image-syncer/releases/download/v1.3.1/image-syncer-v1.3.1-linux-amd64.tar.gz
 
 
 
tar -zvxf image-syncer-v1.3.1-linux-amd64.tar.gz

You can also refer to the official documentation for other installation methods: https://github.com/AliyunContainerService/image-syncer

2.      Create a file, auth.json, for the authentication information of the image repository. In it, include the addresses, usernames, and passwords for Harbor and the Cloud Container Repository Enterprise Edition. For example:

{
 
    "<harbor_url>": {  // Harbor address
 
        "username": "xxx",  // Harbor username
 
        "password": "xxx"  // Harbor password
 
    },
 
    "registry-huadong1.crs.ctyun.cn": {  // Enterprise Edition Instance Address
 
        "username": "xxx",  // Enterprise Edition username
 
        "password": "xxx"  // Enterprise Edition Password
 
    }
 
}

3.      Create an image sync rule file "images.json". In it, specify the relationship between the Harbor source repository and the Cloud Container Repository Enterprise Edition target repository. Example:

{
 
    "<harbor_url>/myns/nginx": "registry-huadong1.crs.ctyun.cn/myns/nginx" // The format is Source Repository: Target Repository. Image-syncer will automatically sync images from the source repository to the target repository
 
}

Note: For the Enterprise Edition instance, you need to first create the corresponding namespace and image repository, or enable the Auto Create Repository option in the namespace.

4.      Execute the image-syncer command to start the image migration.

./image-syncer --auth=./auth.json --images=./images.json

The optional command-line parameters include:

Parameter

Description

–images

Set the path for the image sync rules file

–auth

Set the path for the image repository authentication   file

–log

Set the output path for the log file. By default, it is   printed to the standard error output

–proc

The number of concurrent operations for image   synchronization. The default value is 5

–retries

The number of retries when the sync task fails. The   default value is 2. Retries help to reduce the number of sync task failures   due to network fluctuations.

5.      Upon successful execution of the command, the image will be successfully migrated to the corresponding repository in the Enterprise Edition instance.


IHUTD3HYlNZL