Changing the Container Runtime from Docker to containerd
Dockershim has been removed as of Kubernetes 1.24. To keep pace with the community's technology roadmap, improve cluster stability and resource efficiency, and ensure compatibility with and continuous support from Kubernetes, you are advised to migrate the container runtime from Docker to containerd, which is officially recommended.
containerd is an industry-standard container runtime supported by Kubernetes. Compared with Docker, containerd occupies fewer resources, starts containers faster, and is more stable and secure.
Prerequisites
- At least one cluster that supports containerd nodes has been created. For details, see Mapping Between Node OSs and Container Runtimes.
- There is a Docker node or Docker node pool in your cluster.
Precautions
- The migration of the node container runtime will rebuild the service pods running on the node. Theoretically, services may be interrupted for a short period of time. Therefore, you are advised to ensure that the pods are deployed in HA mode and test the migration impact in the test environment before migrating the services to the production environment during off-peak hours to minimize risks.
- containerd does not support image building. After the migration is complete, you cannot use Docker Build to build images on the containerd nodes, but image pull is not affected. For other differences between Docker and containerd, see Container Runtimes.
- If you have configured node affinity policies for the workloads deployed on the original Docker nodes or node pool, configure affinity policies for the workloads to run on the new containerd nodes or node pool. In this case, you can perform a rolling upgrade to add affinity configurations for the workloads to run on the new containerd nodes or node pool without deleting the existing node affinity configurations. After the rolling upgrade is complete and there are no problems through sufficient tests, delete the affinity configurations on the old Docker nodes.
Migrating from Docker to containerd in the Default Node Pool
You can reset the Docker nodes to containerd nodes.
If the node resource usages are high, resetting an existing Docker node may cause pods on the node to fail to be rebuilt after migration. You can add nodes as needed to avoid this problem.
- Log in to the CCE console and click the cluster name to access the cluster console.
- In the navigation pane, choose Nodes. On the displayed page, click the Nodes tab.
- Select a Docker node in the cluster, and choose More > Disable Scheduling.
- Choose More > Drain Node.

- On the displayed page, enable Forcible Drain and click OK.

- After the drainage is complete, select the node in the node list and choose More > Reset Node.
- Set the container runtime to containerd. You can adjust other parameters as needed or retain them as set during creation.

- Click Next: Confirm. Ensure that you have read and understood the Image Management Service Statement.
- Click Submit. If the node status is Installing, the node is being reset.
When the node status is Running, you can see that the node runtime is switched to containerd. You can log in to the node and run containerd commands such as crictl to view information about the containers running on the node.
- Repeat the preceding steps until Docker on all nodes is replaced with containerd.
Migrating from Docker to containerd in a Custom Node Pool
You can select any method to migrate Docker nodes.
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


