DEV Community

Cover image for 🧱 containerd vs Docker: What's Really Happening Under the Hood?
HexShift
HexShift

Posted on

🧱 containerd vs Docker: What's Really Happening Under the Hood?

If you're familiar with Docker, you've already used containerd, whether you realized it or not. containerd is the container runtime that powers Docker's engine behind the scenes. When you work directly with containerd, you gain more control, improved performance, and greater flexibility for container-heavy workflows.

This article explores how containerd compares to Docker, where it fits in the stack, and why many teams are moving toward it for CI/CD systems, edge deployments, and production-scale container orchestration.

Looking for advanced containerd workflows, hidden commands, and tuning strategies? Check out containerd Power Hacks β€” a downloadable PDF packed with expert tips and real-world techniques.


🐳 Docker: Batteries Included

Docker is a full-featured platform for building, running, and managing containers. It includes the following components:

docker CLI

dockerd daemon and API server

containerd as its internal runtime

Dockerfile build system

Networking and volumes support

Image and registry management

This all-in-one toolkit makes Docker ideal for local development and prototyping. However, in large-scale production environments, the Docker daemon can introduce unnecessary complexity and overhead.


βš™οΈ containerd: Lean and Purpose-Built

containerd is a focused, high-performance container runtime. It handles fewer tasks than Docker but does so with precision:

Pulling and pushing images

Snapshot and image layer management

Running containers using runc

Streaming logs and managing lifecycle events

containerd does not include Dockerfile support or a build system. It was designed to be embedded into other systems like Kubernetes or used directly in environments that require minimal overhead and maximum control.


πŸ” What Really Happens When You Run docker run?

When you run:

docker run alpine

Here's what takes place under the hood:

Step 1: The Docker CLI communicates with the dockerd daemon

Step 2: dockerd passes instructions to containerd

Step 3: containerd pulls the image and starts the container using runc

Step 4: Docker handles networking and volume configuration

Step 5: Output is streamed from containerd back to your terminal

By using containerd directly, you bypass many of these layers and interact more closely with the runtime environment.


πŸ§ͺ Why Use containerd Directly?

Use containerd if:

You need fine-grained control over containers, snapshots, and image caching.

You are building custom CI/CD pipelines and want lightweight tooling.

You are deploying containers on edge devices or stripped-down servers.

You need better insight and debugging options at the runtime level.

containerd avoids opinionated defaults and offers more freedom to design your infrastructure your way.


πŸ’‘ Working with ctr: The containerd CLI

Pull an image:

sudo ctr --namespace devbox image pull docker.io/library/alpine:latest

Run a container:

sudo ctr --namespace devbox run -t --rm docker.io/library/alpine:latest alpine-test /bin/sh

List running containers:

sudo ctr --namespace devbox containers list

Check active namespaces:

sudo ctr namespaces list

All ctr commands require you to specify a namespace. If you forget, containers and images may appear to be missing.


🧰 Docker for Developers, containerd for Deployments

Many teams prefer Docker for development because it is user-friendly and fast to start with. But in production, containerd offers advantages that are hard to ignore.

It launches containers faster, integrates directly with Kubernetes via CRI, and avoids the extra abstraction of the Docker daemon. containerd is also more transparent and modular, making it easier to monitor and debug.

A common pattern is to develop with Docker and deploy with containerd. This keeps local workflows simple while ensuring performance and control in production.


πŸ“˜ Conclusion

containerd is not a replacement for Docker. It is the runtime underneath it. But when used directly, containerd offers new levels of speed, clarity, and control for those managing containers at scale.

By cutting out the Docker layer, you reduce complexity, improve cold start times, and gain deeper insight into how your containers behave.

If you're ready to go beyond surface-level usage and unlock advanced containerd capabilities, download containerd Power Hacks - Hidden Features, Debugging Flows, and Real-World Performance Tuning. It is designed for engineers and operators who want to master containerd in real-world production environments.

Top comments (0)