nerdctl(1)
nerdctl is a Docker-compatible CLI for containerd, providing a user-friendly interface for managing containers and images.
Synopsis
nerdctl [OPTIONS] COMMAND [ARG...]Description
nerdctl is a command-line tool that mimics the Docker CLI but works directly with containerd as the container runtime. It's useful for systems where Docker isn't available or where you want a lightweight alternative that talks directly to containerd.
nerdctl supports most common Docker commands like run, exec, ps, logs, and image management, making it easy to switch from Docker if needed. It can work with both local and remote containerd instances.
Common options
| Flag | What it does |
|---|---|
-H, --host | Specify containerd socket address (e.g., unix:///run/containerd/containerd.sock) |
-n, --namespace | Containerd namespace to use (default: k8s.io) |
--debug | Enable debug output |
-v, --version | Show nerdctl version |
--cgroup-manager | Cgroup manager to use: cgroupfs or systemd |
--insecure-registry | Allow pushing to insecure (non-HTTPS) registries |
Examples
Run an interactive Alpine container and remove it when done
nerdctl run -it --rm alpine:latest /bin/shList all containers (running and stopped)
nerdctl ps -aShow all available container images
nerdctl imagesPull the latest nginx image from Docker Hub
nerdctl pull docker.io/library/nginx:latestExecute an interactive bash shell inside a running container
nerdctl exec -it mycontainer bashFollow and display container logs in real-time
nerdctl logs -f mycontainerBuild a container image from a Dockerfile in the current directory
nerdctl build -t myapp:1.0 .List containers in the k8s.io namespace (useful for Kubernetes nodes)
nerdctl -n k8s.io ps