Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Migrating Images to SWR Using image-syncer

Updated on 2024-10-14 GMT+08:00

Scenarios

If a small quantity of images need to be migrated, you can use Docker commands. However, for thousands of images and several TBs of image repository data, it takes a long time and even data may be lost. In this case, you can use the open source image migration tool image-syncer.

Procedure

  1. Download image-syncer. Then, decompress and run it.

    The following uses image-syncer v1.3.1 as an example.

    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

  2. Create auth.json, the authentication information file of the image repositories.

    image-syncer can migrate Docker Registry V2-based repositories. Write the authentication information of the source and target repositories. The following is an example:

    {
        "swr.××××.myhuaweicloud.com": {
            "username": "××××@F1I3Q……",
            "password": "2fd4c869ea0……"
        },
        "swr.××××.myhuaweicloud.com": {
            "username": "××××@4N3FA……",
            "password": "f1c82b57855f9d35……"
        }

    In the command, swr.××××.myhuaweicloud.com indicates the image repository address. You can obtain the username and password from the login command.

    Log in to the SWR console, and click Generate Login Command in the upper right corner to obtain the login command.

    Figure 1 Generating a login command

  3. Create images.json, the image synchronization description file.

    In the following example, the source repository address is on the left, and the target repository address is on the right. image-syncer also supports other description modes. For details, see README.md.
    {
    "swr.ap-southeast-3.myhuaweicloud.com/org-ss/canary-consumer": "swr.ap-southeast-1.myhuaweicloud.com/dev-container/canary-consumer"
     }

  4. Run the following command to migrate the images to SWR:

    ./image-syncer --auth=./auth.json --images=./images.json --namespace=dev-container --registry=swr.ap-southeast-1.myhuaweicloud.com --retries=3 --log=./log

    Table 1 Command parameter description

    Parameter

    Description

    --config

    Path of the configuration file. This file needs to be created before you start the synchronization. By default, the configuration file is the config.json file in the current directory. (This parameter can be replaced with parameters --auth and --images which represent authentication information and repository synchronization rules respectively.)

    --images

    Path of the image rules file. This file needs to be created before you start the synchronization. By default, the rule file is the images.json file in the current directory.

    --auth

    Path of the authentication file. This file needs to be created before you start the synchronization. By default, the authentication file is the auth.json file in the current directory.

    --log

    Path of the log file. Logs will be printed to Stderr by default. You need to use cat to check logs.

    --namespace

    default-namespace. default-namespace can also be set by environment variable DEFAULT_NAMESPACE. If both the parameter and environment variable are set, the parameter will take precedence. default-namespace will work only if default-registry is not empty.

    --proc

    Number of goroutines. The default value is 5. You are advised to use this value and do not change it.

    --retries

    Number of retries. The default value is 2. The retries of failed sync tasks will start after all sync tasks are executed once. Retrying sync tasks will resolve most occasional network problems during synchronization.

    --registry

    default-registry. default-registry can also be set by environment variable DEFAULT_REGISTRY. If both the parameter and environment variable are set, the parameter will take precedence. default-registry will work only if default-namespace is not empty.

  5. Log in to the target image repository to check the migrated images.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback