$linuxjunkies
>

nerdctl(1)

nerdctl is a Docker-compatible CLI for containerd, providing a user-friendly interface for managing containers and images.

UbuntuDebianFedoraArch

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

FlagWhat it does
-H, --hostSpecify containerd socket address (e.g., unix:///run/containerd/containerd.sock)
-n, --namespaceContainerd namespace to use (default: k8s.io)
--debugEnable debug output
-v, --versionShow nerdctl version
--cgroup-managerCgroup manager to use: cgroupfs or systemd
--insecure-registryAllow pushing to insecure (non-HTTPS) registries

Examples

Run an interactive Alpine container and remove it when done

nerdctl run -it --rm alpine:latest /bin/sh

List all containers (running and stopped)

nerdctl ps -a

Show all available container images

nerdctl images

Pull the latest nginx image from Docker Hub

nerdctl pull docker.io/library/nginx:latest

Execute an interactive bash shell inside a running container

nerdctl exec -it mycontainer bash

Follow and display container logs in real-time

nerdctl logs -f mycontainer

Build 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

Related commands