QA
Intermediate LevelDocker & Deployment

What is the Open Container Initiative (OCI), containerd, and runc?

❓ Interview Prompt: Explain OCI image-spec and runtime-spec standards, containerd as the high-level runtime, and runc as the low-level container executor.

The container ecosystem is built on open standards to prevent vendor lock-in:

Open Container Initiative (OCI):

An open governance body (Linux Foundation) that defines two specifications:

1
image-spec: Defines the format of a container image (layer tarballs + JSON config manifest). Any OCI-compliant tool (Docker, Podman, Buildah) can build and consume images.
2
runtime-spec: Defines the interface for running a container from an OCI image bundle (filesystem + config.json). Any OCI runtime (runc, crun, gVisor) must implement this spec.

Execution Stack:

dockerd → containerd (gRPC) → containerd-shim → runc → container process

containerd (High-Level Runtime):

An industrial-grade container runtime (donated by Docker to CNCF) that manages the full container lifecycle:

•
Pulling and pushing OCI images.
•
Managing container storage snapshots (via Snapshotter plugins).
•
Starting/stopping containers by delegating to runc.
•
Used directly by Kubernetes (via CRI plugin) and Docker.

runc (Low-Level OCI Runtime):

A CLI tool that implements the OCI runtime-spec — it reads the config.json bundle and:

1
Creates Linux namespaces and cgroups.
2
Sets up the rootfs (chroot).
3
Executes the container's entrypoint process.

After starting the container, runc exits — the container runs without runc.

Code Implementation Example

bash
# containerd is the runtime used by Kubernetes
crictl --runtime-endpoint unix:///run/containerd/containerd.sock ps

# runc is the low-level OCI runtime
# Manually run a container via runc (what containerd does internally):
mkdir -p /tmp/mycontainer/rootfs
docker export $(docker create alpine) | tar -C /tmp/mycontainer/rootfs -xf -
cd /tmp/mycontainer
runc spec   # generates config.json from OCI spec template
runc run mycontainer   # execute container process directly

# Verify OCI image compliance
skopeo inspect docker://myapp:latest | jq '.MediaType'
# "application/vnd.oci.image.manifest.v1+json"  ← OCI compliant
💡runc implements the OCI runtime-spec — containerd calls it under the hood to create namespace-isolated containers.
🎯 Interview Key Takeaway

OCI defines portable image/runtime standards. containerd manages lifecycle; runc creates namespaces/cgroups and executes the process. Any OCI-compliant runtime can replace runc.

#OCI#containerd#runc#Standards#Container Runtime#Intermediate
Back to all Docker & Deployment Questions→

More Docker & Deployment Interview Questions

Beginner LevelDocker & Deployment

How do Docker Multi-Stage Builds minimize image size and improve security?

Beginner LevelDocker & Deployment

What is the difference between a Docker Container and a Virtual Machine (VM)?

Beginner LevelDocker & Deployment

What is the difference between a Docker Image and a Docker Container?