- What's new
- Function Overview
- Service Overview
- Getting Started
-
User Guide
- Introduction
- Permissions Management
- Basics of the Container Engine
-
Image Management
- Uploading an Image Through a Container Engine Client (Recommended)
- Obtaining a Long-Term Valid Login Command
- Uploading an Image Through SWR Console
- Pulling an Image
- Setting Image Attributes
- Sharing a Private Image
- Adding a Trigger
- Adding an Image Retention Policy
- Configuring Automatic Image Synchronization Between Regions
- Image Center
- Organization Management
- User Permissions
- Auditing
- Change History
- Best Practices
-
API Reference
- Before You Start
- Calling APIs
- API Overview
-
API
- Organization Management
- Managing Image Repositories
- Image Tag Management
- Shared Account Management
- API Version
- Organization Permission Management
- Image Permission Management
- Image Synchronization Management
- Trigger Management
- Image Retention Policy Management
- Temporary Login Command
- Quota Management
- Other
- Example Applications
- Appendixes
- SDK Reference
-
FAQs
- General FAQs
- Login Issues
- Synchronizing Images
- Pushing an Image
- Pulling an Image
-
Troubleshooting
- Why Does the Login Command Fail to Be Executed?
- Why Does an Image Fail to Be Pushed Through a Container Engine Client?
- Why Does an Image Fail to Be Uploaded Through SWR Console?
- Why Does the docker pull Command Fail to Be Executed?
- What Should I Do If Images Cannot Be Downloaded from Private Networks?
- What Do I Do If an Error Occurs When I Call an API?
-
Other FAQs
- Why Does a CCE Workload Cannot Pull an Image from SWR and a Message "Not Logged In" Is Displayed?
- How Many Tenants Can I Share an SWR Private Image With?
- Why Is an Image Pushed Using a Container Engine Client to SWR Different in Size From One Uploaded Through the SWR Console?
- Can I Pull Images on the SWR Console to a Local PC?
- Videos
- Glossary
-
More Documents
- User Guide
- API Reference
- User Guide (Paris Regions)
- API Reference (Paris Regions)
- User Guide (Kuala Lumpur Region)
- API Reference (Kuala Lumpur Region)
-
User Guide (Ankara Region)
- Service Overview
- Overview
- Permissions Management
- Basics of Docker
-
Image Management
- Pushing an Image Through a Container Engine Client
- Obtaining a Long-Term Valid Docker Login Command
- Obtaining a Long-Term Valid containerd Pull/Push Command
- Uploading an Image Through the SWR Console
- Pulling an Image
- Setting Image Attributes
- Sharing Private Images
- Adding a Trigger
- Adding an Image Retention Policy
- Organization Management
- User Permissions
- FAQs
-
API Reference (Ankara Region)
- Before You Start
- API Overview
- Calling APIs
- API
- Appendixes
- Permissions and Supported Actions
- General Reference
Copied.
Migrating Images to SWR Using image-syncer
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
- 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
- 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 - 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" }
- 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.
- Log in to the target image repository to check the migrated images.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot