Changing the Container Runtime from Docker to containerd
Dockershim was removed in Kubernetes 1.24. To maintain compatibility with upstream Kubernetes, ensure continuous support, and improve cluster stability and resource efficiency, migrate the container runtime from Docker to containerd, which is the officially recommended runtime.
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 is available. For details, see Mapping Between Node OSs and Container Runtimes.
- There is a Docker node or Docker node pool in your cluster.
Precautions
- Migrating a node's container runtime rebuilds all service pods on that node, which may cause brief service interruptions. To minimize risk, ensure pods are deployed in HA mode, validate the migration impact in a test environment, and perform production migrations during off-peak hours.
- 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.
- Read the instructions, select the check box for confirmation, and click Submit. If the node status is Installing, the node is being reset.
When the node status is Running, check whether the node runtime has switched to containerd by logging into the node and running commands such as crictl ps or crictl inspect to view container information.
- 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


