Skip to main content
🎓 Claude Code Masterclass Learn AI-assisted development on Udemy — plus the companion book on Leanpub & Amazon. Start Learning
Fix cAdvisor Containerd Namespace Mismatch with Docker 29
DevOps

Fix cAdvisor Containerd Namespace Mismatch with Docker 29

Fix cAdvisor not seeing Docker 29 containers. Set --containerd-namespace=moby to match Docker's containerd namespace instead of the k8s.io default.

LB
Luca Berton
· 2 min read

If you upgraded to Docker 29 and your cAdvisor container metrics stopped showing up, the issue is a containerd namespace mismatch — not a storage driver problem.

The Problem

Docker 29 defaults to the containerd image store, which replaces the legacy graphdriver (overlay2) layerdb layout with containerd’s native image management. When cAdvisor runs in containerd mode, it defaults to the k8s.io containerd namespace — but Docker creates containers under the moby namespace. The result: cAdvisor sees zero containers.

Quick Fix

# Run cAdvisor pointing at the moby namespace
docker run -d \
  --name=cadvisor \
  --volume=/:/rootfs:ro \
  --volume=/var/run/docker.sock:/var/run/docker.sock:ro \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --volume=/run/containerd/containerd.sock:/run/containerd/containerd.sock:ro \
  --network=host \
  gcr.io/cadvisor/cadvisor:latest \
  --containerd \
  --containerd-namespace=moby

The key flags are:

  • --containerd-namespace=moby — tells cAdvisor to read the moby namespace, not k8s.io
  • --containerd — enables containerd mode instead of the legacy Docker socket mode
  • --volume=/run/containerd/containerd.sock:/run/containerd/containerd.sock:ro — mounts the containerd socket

How to Verify the Correct Namespace

If moby doesn’t work, check what namespace your Docker daemon is using:

# List all containerd namespaces
ctr --address /run/containerd/containerd.sock ns ls

# List containers in the moby namespace
ctr --address /run/containerd/containerd.sock -n moby containers ls

# List images in the moby namespace
ctr --address /run/containerd/containerd.sock -n moby images ls

You should see Docker containers listed under the moby namespace. If your Docker daemon uses a different namespace, adjust accordingly.

Docker Compose Version

For Docker Compose, add the namespace and containerd flags as command arguments:

services:
  cadvisor:
    image: gcr.io/cadvisor/cadvisor:latest
    volumes:
      - /:/rootfs:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
      - /run/containerd/containerd.sock:/run/containerd/containerd.sock:ro
    network_mode: host
    command:
      - '--containerd'
      - '--containerd-namespace=moby'
    privileged: true

Root Cause: Why This Happens

Docker 29’s New Image Store

Docker 29 (both Docker Engine and Docker Desktop) ships with the containerd image store enabled by default. This replaces:

Legacy (Docker < 29)New (Docker 29+)
Graphdriver: overlay2Containerd native image store
LayerDB at /var/lib/docker/image/overlay2/layerdbContainerd image store in /var/lib/docker/image/
Containers created via Docker APIContainers created via containerd snapshots in moby namespace

cAdvisor’s Default Namespace

cAdvisor’s containerd integration defaults to the k8s.io namespace — the namespace used by Kubernetes when it embeds containerd. When you run cAdvisor next to Docker (not Kubernetes), that default is wrong. You must explicitly set --containerd-namespace=moby.

Alternative: Docker Socket Mode

If you want to avoid the containerd namespace issue entirely, run cAdvisor in Docker socket mode instead of containerd mode:

docker run -d \
  --name=cadvisor \
  --volume=/:/rootfs:ro \
  --volume=/var/run/docker.sock:/var/run/docker.sock:ro \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --network=host \
  --privileged \
  gcr.io/cadvisor/cadvisor:latest

Without the --containerd flag, cAdvisor falls back to reading the Docker socket, which abstracts away the containerd namespace detail. The trade-off: you get Docker-level container visibility but lose the granular containerd image and snapshot metrics.

Environment Variables (Alternative)

You can also set the namespace via environment variable if your cAdvisor setup supports it:

export CONTAINERD_NAMESPACE=moby

Or in Docker Compose:

environment:
  - CONTAINERD_NAMESPACE=moby

About the Author

I am Luca Berton, AI and Cloud Advisor. I help teams debug and optimize their container infrastructure. Book a consultation to fix your Docker issues.

#Docker #containerd #cAdvisor #Monitoring #Troubleshooting #DevOps
Share:
Kubernetes & Containerization

Need help with Kubernetes & Containerization?

Master Kubernetes and container orchestration with hands-on workshops and architecture consulting.

Learn more about Kubernetes & Containerization

Want to operate this yourself, in production?

Take the free AI Platform Engineer Readiness Scorecard to see which skills transfer — then build a production-shaped AI platform in the 4-week Bootcamp.

Take the Scorecard →
Luca Berton — The Production AI Expert, Docker Captain

Luca Berton

The Production AI Expert · Docker Captain · KubeCon Speaker

15+ years in enterprise infrastructure. Author of 8 technical books, creator of Ansible Pilot (1M+ YouTube views, 648K site users). Former Red Hat engineer. Speaker at KubeCon EU 2026 and Red Hat Summit 2026.

Free 30-min Production AI consultation

Book Now