Server Migration Center (SMC) allows you to migrate servers as images to Container Registry. Then, you can use the images to deploy the servers. This way, you can migrate containerized applications at low costs. Containerized applications are distributed applications that are managed automatically and deployed with high agility and low-security risks. Application containerization improves resource usage and reduces computing costs. This topic describes how to migrate a server to Container Registry.
Prerequisites
Container Registry is activated, and an image repository is created. For more information, see Create a repository and build images.
Background information
- For information about Docker container images, see Terms.
- During migration, SMC creates an intermediate instance. The intermediate instance incurs a small fee. For more information, see Pay-as-you-go.
- SMC releases the intermediate instance after the migration job enters the Finished or Expired state, or when the job is deleted.
Step 1: Prepare for the migration
- Create a RAM role to be used by the intermediate instance that is created by SMC for migration.
Set the following key parameters for the RAM role. For more information, see Create a RAM role for a trusted Alibaba Cloud service.
- Select Trusted Entity: Select Alibaba Cloud Service.
- Role Type: Select Normal Service Role.
- Select Trusted Service: Select Elastic Compute Service.
- Create a custom policy for the RAM role of the intermediate instance. The policy grants the minimum permissions that are required to migrate a server to Container Registry.
The following example shows a sample policy. This policy is attached to the RAM role. For more information, see Create a custom policy and Grant permissions to a RAM role.
{ "Statement": [ { "Effect": "Allow", "Action": [ "cr:GetAuthorizationToken", "cr:PushRepository", "cr:PullRepository", "cr:CreateRepository" ], "Resource": "*" } ], "Version": "1" }
Step 2: Migrate a source server to Container Registry
- Import the information of a migration source.
Import the information of a Linux server to the SMC console by using one of the following methods:
- Import the information of a migration source by using the SMC console
- Import the information of a migration source by using the SMC client
Important
- The SMC client V2.3.0 and later support server migration to Container Registry. Therefore, you must use the SMC client V2.3.0 or later. Click download the SMC client to download the SMC client of the latest version.
- Make sure that the SMC client is running during migration. If data transfer is interrupted, you can restart the client and the migration job to resume the migration.
- Create and start a migration job.
The migration job immediately starts after it is created. Then, the migration job enters the Finished or InError state.
- If the migration job enters the Finished state, the job is complete, and a container image is generated.
- If the migration job enters the InError state, the job fails. You can check the logs to troubleshoot the failure. Then, restart the migration job. For information about common errors and solutions, see SMC FAQ.
- If the migration job enters the Finished state, the job is complete, and a container image is generated.
Step 3: Verify the container image
After you migrate the source server to Container Registry, a container image is created. You can use the container image to deploy a containerized application. The following example shows you how to verify a container image. A container image of NGINX is used in the example.
- Create a Kubernetes cluster in the Container Service for Kubernetes (ACK) console. For more information, see Create an ACK dedicated cluster.
- Create a containerized application.
- Verify that the NGINX welcome page is displayed when you access the external endpoint in a browser.