[
nerdctl: Docker-compatible CLI for containerd
nerdctl is a Docker-compatible CLI for containerd.
docker
nerdctl compose up)
nerdctl is a non-core sub-project of containerd.
*1: P2P image distribution (IPFS) is completely optional. Your host is NOT connected to any P2P network, unless you opt in to install and run IPFS daemon.
Examples
Basic usage
To run a container with the default bridge CNI network (10.4.0.0/24):
# nerdctl run -it --rm alpineTo build an image using BuildKit:
# nerdctl build -t foo /some-dockerfile-directory
# nerdctl run -it --rm fooTo build and send output to a local directory using BuildKit:
# nerdctl build -o type=local,dest=. /some-dockerfile-directoryTo run containers from docker-compose.yaml:
# nerdctl compose -f ./examples/compose-wordpress/docker-compose.yaml upSee also ./examples/compose-wordpress.
Debugging Kubernetes
To list local Kubernetes containers:
# nerdctl --namespace k8s.io ps -aTo build an image for local Kubernetes without using registry:
# nerdctl --namespace k8s.io build -t foo /some-dockerfile-directory
# kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: foo
spec:
containers:
- name: foo
image: foo
imagePullPolicy: Never
EOFTo load an image archive (docker save format or OCI format) into local Kubernetes:
# nerdctl --namespace k8s.io load < /path/to/image.tarRootless mode
To launch rootless containerd:
$ containerd-rootless-setuptool.sh installTo run a container with rootless containerd:
$ nerdctl run -d -p 8080:80 --name nginx nginx:alpineSee ./docs/rootless.md.
Install
Binaries are available here: https://github.com/containerd/nerdctl/releases
In addition to containerd, the following components should be installed:
- CNI plugins: for using
nerdctl run.- v1.1.0 or later is highly recommended. Older versions require extra CNI isolation plugin for isolating bridge networks (
nerdctl network create).
- v1.1.0 or later is highly recommended. Older versions require extra CNI isolation plugin for isolating bridge networks (
- BuildKit (OPTIONAL): for using
nerdctl build. BuildKit daemon (buildkitd) needs to be running. See also the document about setting up BuildKit. - RootlessKit and slirp4netns (OPTIONAL): for Rootless mode
- RootlessKit needs to be v0.10.0 or later. v0.14.1 or later is recommended.
- slirp4netns needs to be v0.4.0 or later. v1.1.7 or later is recommended.
These dependencies are included in nerdctl-full-<VERSION>-<OS>-<ARCH>.tar.gz, but not included in nerdctl-<VERSION>-<OS>-<ARCH>.tar.gz.
Brew
On Linux systems you can install nerdctl via brew:
brew install nerdctlThis is currently not supported for macOS. The section below shows how to install on macOS using brew.
macOS
Lima project provides Linux virtual machines for macOS, with built-in integration for nerdctl.
$ brew install lima
$ limactl start
$ lima nerdctl run -d --name nginx -p 127.0.0.1:8080:80 nginx:alpineFreeBSD
See ./docs/freebsd.md.
Windows
- Linux containers: Known to work on WSL2
- Windows containers: experimental support for Windows (see below for features that are currently known to work)
Docker
To run containerd and nerdctl inside Docker:
docker build -t nerdctl .
docker run -it --rm --privileged nerdctlMotivation
The goal of nerdctl is to facilitate experimenting the cutting-edge features of containerd that are not present in Docker (see below).
Note that competing with Docker is not the goal of nerdctl. Those cutting-edge features are expected to be eventually available in Docker as well.
Also, nerdctl might be potentially useful for debugging Kubernetes clusters, but it is not the primary goal.
Features present in nerdctl but not present in Docker
Major:
- On-demand image pulling (lazy-pulling) using Stargz/Nydus/OverlayBD Snapshotter:
nerdctl --snapshotter=stargz|nydus|overlaybd run IMAGE. - Image encryption and decryption using ocicrypt (imgcrypt):
nerdctl image (encrypt|decrypt) SRC DST - P2P image distribution using IPFS:
nerdctl run ipfs://CID. P2P image distribution (IPFS) is completely optional. Your host is NOT connected to any P2P network, unless you opt in to install and run IPFS daemon. - Recursive read-only (RRO) bind-mount:
nerdctl run -v /mnt:/mnt:rro(make children such as/mnt/usbto be read-only, too). Requires kernel >= 5.12, and crun >= 1.4 or runc >= 1.1 (PR #3272). - Cosign integration:
nerdctl pull --verify=cosignandnerdctl push --sign=cosign, and in Compose - Accelerated rootless containers using bypass4netns:
nerdctl run --label nerdctl/bypass4netns=true
Minor:
- Namespacing:
nerdctl --namespace=<NS> ps. (NOTE: All Kubernetes containers are in thek8s.iocontainerd namespace regardless to Kubernetes namespaces) - Exporting Docker/OCI dual-format archives:
nerdctl save. - Importing OCI archives as well as Docker archives:
nerdctl load. - Specifying a non-image rootfs:
nerdctl run -it --rootfs <ROOTFS> /bin/sh. The CLI syntax conforms to Podman convention. - Connecting a container to multiple networks at once:
nerdctl run --net foo --net bar - Running FreeBSD jails.
- Better multi-platform support, e.g.,
nerdctl pull --all-platforms IMAGE - Applying an (existing) AppArmor profile to rootless containers:
nerdctl run --security-opt apparmor=<PROFILE>. Usesudo nerdctl apparmor loadto load thenerdctl-defaultprofile.
Trivial:
- Inspecting raw OCI config:
nerdctl container inspect --mode=native.
Similar tools
-
ctr: incompatible with Docker CLI, and not friendly to users. Notably,ctrlacks the equivalents of the following nerdctl commands:nerdctl run -p <PORT>nerdctl run --restart=always --net=bridgenerdctl pullwith~/.docker/config.jsonand credential helper binaries such asdocker-credential-ecr-loginnerdctl logsnerdctl buildnerdctl compose up
-
crictl: incompatible with Docker CLI, not friendly to users, and does not support non-CRI features -
k3c v0.2 (abandoned): needs an extra daemon, and does not support non-CRI features
-
Rancher Kim (nee k3c v0.3): needs Kubernetes, and only focuses on image management commands such as
kim buildandkim push -
PouchContainer (abandoned?): needs an extra daemon
Developer guide
nerdctl is a containerd non-core sub-project, licensed under the Apache 2.0 license. As a containerd non-core sub-project, you will find the:
information in our containerd/project repository.
Compiling nerdctl from source
Tips: You should make your Go toolchain newer than 1.17.
Run make && sudo make install.
Using go install github.com/containerd/nerdctl/cmd/nerdctl is possible, but unrecommended because it does not fill version strings printed in nerdctl version
Test suite
Running unit tests
Run go test -v ./pkg/...
Running integration test suite against nerdctl
Run go test -exec sudo -v ./cmd/nerdctl/... after make && sudo make install.
For testing rootless mode, -exec sudo is not needed.
To run tests in a container:
docker build -t test-integration --target test-integration .
docker run -t --rm --privileged test-integrationRunning integration test suite against Docker
Run go test -exec sudo -v ./cmd/nerdctl/... -args -test.target=docker to ensure that the test suite is compatible with Docker.
Contributing to nerdctl
Lots of commands and flags are currently missing. Pull requests are highly welcome.
Please certify your Developer Certificate of Origin (DCO), by signing off your commit with git commit -s and with your real name.
Command reference
Unlisted docker CLI flags are unimplemented yet in nerdctl CLI.
It does not necessarily mean that the corresponding features are missing in containerd.
- Container management
π³ π¦ nerdctl runπ³ π¦ nerdctl execπ³ π¦ nerdctl createπ³ nerdctl cpπ³ π¦ nerdctl psπ³ π¦ nerdctl inspectπ³ nerdctl logsπ³ nerdctl portπ³ nerdctl rmπ³ nerdctl stopπ³ nerdctl startπ³ nerdctl restartπ³ nerdctl updateπ³ nerdctl waitπ³ nerdctl killπ³ nerdctl pauseπ³ nerdctl unpauseπ³ docker renameπ³ nerdctl container prune
- Build
- Image management
- Registry
- Network management
- Volume management
- Namespace management
- AppArmor profile management
- Builder management
- System
- Stats
- Shell completion
- Compose
π³ nerdctl composeπ³ nerdctl compose upπ³ nerdctl compose logsπ³ nerdctl compose buildπ³ nerdctl compose createπ³ nerdctl compose execπ³ nerdctl compose downπ³ nerdctl compose imagesπ³ nerdctl compose startπ³ nerdctl compose stopπ³ nerdctl compose portπ³ nerdctl compose psπ³ nerdctl compose pullπ³ nerdctl compose pushπ³ nerdctl compose pauseπ³ nerdctl compose unpauseπ³ nerdctl compose configπ³ nerdctl compose killπ³ nerdctl compose restartπ³ nerdctl compose rmπ³ nerdctl compose runπ³ nerdctl compose topπ³ nerdctl compose version
- IPFS management
- Global flags
- Unimplemented Docker commands
- Additional documents
Container management
π³ π¦ nerdctl run
Run a command in a new container.
Usage: nerdctl run [OPTIONS] IMAGE [COMMAND] [ARG...]
ipfs:// prefix can be used for IMAGE to pull it from IPFS. See /docs/ipfs.md for details.
Basic flags:
π³ π¦ -i, --interactive: Keep STDIN open even if not attached"π³ π¦ -t, --tty: Allocate a pseudo-TTYβ οΈ WIP: currently-tconflicts with-d
π³ π¦ -d, --detach: Run container in background and print container IDπ³ --restart=(no|always|on-failure|unless-stopped): Restart policy to apply when a container exits- Default: "no"
- always: Always restart the container if it stops.
- on-failure[:max-retries]: Restart only if the container exits with a non-zero exit status. Optionally, limit the number of times attempts to restart the container using the :max-retries option.
- unless-stopped: Always restart the container unless it is stopped.
π³ --rm: Automatically remove the container when it exitsπ³ --pull=(always|missing|never): Pull image before running- Default: "missing"
π³ --pid=(host|container:<container>): PID namespace to useπ³ --uts=(host): UTS namespace to useπ³ --stop-signal: Signal to stop a container (default "SIGTERM")π³ --stop-timeout: Timeout (in seconds) to stop a container
Platform flags:
π³ --platform=(amd64|arm64|...): Set platform
Init process flags:
π³ --init: Run an init inside the container that forwards signals and reaps processes.π€ --init-binary=<binary-name>: The custom init binary to use. We suggest you use the tini binary which is used in Docker project to get the same behavior. Please make sure the binary exists in yourPATH.- Default:
tini
- Default:
Network flags:
π³ --net, --network=(bridge|host|none|container:<container>|<CNI>): Connect a container to a network.- Default: "bridge"
- 'container:<name|id>': reuse another container's network stack, container has to be precreated.
π€ Unlike Docker, this flag can be specified multiple times (--net foo --net bar)
π³ -p, --publish: Publish a container's port(s) to the hostπ³ --dns: Set custom DNS serversπ³ --dns-search: Set custom DNS search domainsπ³ --dns-opt, --dns-option: Set DNS optionsπ³ -h, --hostname: Container host nameπ³ --add-host: Add a custom host-to-IP mapping (host:ip)π³ --ip: Specific static IP address(es) to useπ³ --mac-address: Specific MAC address to use. Be aware that it does not check if manually specified MAC addresses are unique. Supports network typebridgeandmacvlan
Resource flags:
π³ --cpus: Number of CPUsπ³ --cpu-quota: Limit the CPU CFS (Completely Fair Scheduler) quotaπ³ --cpu-period: Limit the CPU CFS (Completely Fair Scheduler) periodπ³ --cpu-shares: CPU shares (relative weight)π³ --cpuset-cpus: CPUs in which to allow execution (0-3, 0,1)π³ --cpuset-mems: Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systemsπ³ --memory: Memory limitπ³ --memory-reservation: Memory soft limitπ³ --memory-swap: Swap limit equal to memory plus swap: '-1' to enable unlimited swapπ³ --memory-swappiness: Tune container memory swappiness (0 to 100) (default -1)π³ --kernel-memory: Kernel memory limit (deprecated)π³ --oom-kill-disable: Disable OOM Killerπ³ --oom-score-adj: Tune containerβs OOM preferences (-1000 to 1000, rootless: 100 to 1000)π³ --pids-limit: Tune container pids limitπ€ --cgroup-conf: Configure cgroup v2 (key=value)π³ --blkio-weight: Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)π³ --cgroupns=(host|private): Cgroup namespace to use- Default: "private" on cgroup v2 hosts, "host" on cgroup v1 hosts
π³ --cgroup-parent: Optional parent cgroup for the containerπ³ --device: Add a host device to the container
Intel RDT flags:
π€ --rdt-class=CLASS: Name of the RDT class (or CLOS) to associate the container wit
User flags:
π³ π¦ -u, --user: Username or UID (format: <name|uid>[:<group|gid>])π€ --umask: Set the umask inside the container. Defaults to 0022. Corresponds to Podman CLI.π³ --group-add: Add additional groups to join
Security flags:
π³ --security-opt seccomp=<PROFILE_JSON_FILE>: specify custom seccomp profileπ³ --security-opt apparmor=<PROFILE>: specify custom AppArmor profileπ³ --security-opt no-new-privileges: disallow privilege escalation, e.g., setuid and file capabilitiesπ€ --security-opt privileged-without-host-devices: Don't pass host devices to privileged containersπ³ --cap-add=<CAP>: Add Linux capabilitiesπ³ --cap-drop=<CAP>: Drop Linux capabilitiesπ³ --privileged: Give extended privileges to this container
Runtime flags:
π³ --runtime: Runtime to use for this container, e.g. "crun", or "io.containerd.runsc.v1".π³ --sysctl: Sysctl options, e.g "net.ipv4.ip_forward=1"
Volume flags:
π³ π¦ -v, --volume <SRC>:<DST>[:<OPT>]: Bind mount a volume, e.g.,-v /mnt:/mnt:rro,rprivateπ³ optionrw: Read/Write (when writable)π³ optionro: Non-recursive read-onlyπ€ optionrro: Recursive read-only. Should be used in conjunction withrprivate. e.g.,-v /mnt:/mnt:rro,rprivatemakes children such as/mnt/usbto be read-only, too. Requires kernel >= 5.12, and crun >= 1.4 or runc >= 1.1 (PR #3272). With older runc,rrojust works asro.π³ optionshared,slave,private: Non-recursive "shared" / "slave" / "private" propagationπ³ optionrshared,rslave,rprivate: Recursive "shared" / "slave" / "private" propagationπ€ optionbind: Not-recursively bind-mountedπ€ optionrbind: Recursively bind-mounted
π³ --tmpfs: Mount a tmpfs directory, e.g.--tmpfs /tmp:size=64m,exec.π³ --mount: Attach a filesystem mount to the container. Consists of multiple key-value pairs, separated by commas and each consisting of a<key>=<value>tuple. e.g.,-- mount type=bind,source=/src,target=/app,bind-propagation=shared.π³ type: Current supported mount types arebind,volume,tmpfs. The defaul type will be set tovolumeif not specified. i.e.,--mount src=vol-1,dst=/app,readonlyequals--mount type=volum,src=vol-1,dst=/app,readonly- Common Options:
π³ src,source: Mount source spec for bind and volume. Mandatory for bind.π³ dst,destination,target: Mount destination spec.π³ readonly,ro,rw,rro: Filesystem permissinos.
- Options specific to
bind:π³ bind-propagation:shared,slave,private,rshared,rslave, orrprivate(default).π³ bind-nonrecursive:trueorfalse(default). If set to true, submounts are not recursively bind-mounted. This option is useful for readonly bind mount.- unimplemented options:
consistency
- Options specific to
tmpfs:π³ tmpfs-size: Size of the tmpfs mount in bytes. Unlimited by default.π³ tmpfs-mode: File mode of the tmpfs in octal. Defaults to1777or world-writable.
- Options specific to
volume:- unimplemented options:
volume-nocopy,volume-label,volume-driver,volume-opt
- unimplemented options:
Rootfs flags:
π³ --read-only: Mount the container's root filesystem as read onlyπ€ --rootfs: The first argument is not an image but the rootfs to the exploded container. Corresponds to Podman CLI.
Env flags:
π³ π¦ --entrypoint: Overwrite the default ENTRYPOINT of the imageπ³ π¦ -w, --workdir: Working directory inside the containerπ³ π¦ -e, --env: Set environment variablesπ³ π¦ --env-file: Set environment variables from file
Metadata flags:
π³ π¦ --name: Assign a name to the containerπ³ π¦ -l, --label: Set meta data on a containerπ³ π¦ --label-file: Read in a line delimited file of labelsπ³ π¦ --cidfile: Write the container ID to the fileπ€ --pidfile: file path to write the task's pid. The CLI syntax conforms to Podman convention.
Logging flags:
π³ --log-driver=(json-file|journald|fluentd|syslog): Logging driver for the container (defaultjson-file).π³ --log-driver=json-file: The logs are formatted as JSON. The default logging driver for nerdctl.- The
json-filelogging driver supports the following logging options:π³ --log-opt=max-size=<MAX-SIZE>: The maximum size of the log before it is rolled. A positive integer plus a modifier representing the unit of measure (k, m, or g). Defaults to unlimited.π³ --log-opt=max-file=<MAX-FILE>: The maximum number of log files that can be present. If rolling the logs creates excess files, the oldest file is removed. Only effective whenmax-sizeis also set. A positive integer. Defaults to 1.π€ --log-opt=log-path=<LOG-PATH>: The log path where the logs are written. The path will be created if it does not exist. If the log file exists, the old file will be renamed to<LOG-PATH>.1.- Default:
<data-root>/<containerd-socket-hash>/<namespace>/<container-id>/<container-id>-json.log - Example:
/var/lib/nerdctl/1935db59/containers/default/<container-id>/<container-id>-json.log
- Default:
- The
π³ --log-driver=journald: Writes log messages tojournald. Thejournalddaemon must be running on the host machine.π³ --log-opt=tag=<TEMPLATE>: Specify template to setSYSLOG_IDENTIFIERvalue in journald logs.
π³ --log-driver=fluentd: Writes log messages tofluentd. Thefluentddaemon must be running on the host machine.- The
fluentdlogging driver supports the following logging options:π³ --log-opt=fluentd-address=<ADDRESS>: The address of thefluentddaemon, tcp(default) and unix sockets are supported..π³ --log-opt=fluentd-async=<true|false>: Enable async mode for fluentd. The default value is false.π³ --log-opt=fluentd-buffer-limit=<LIMIT>: The buffer limit for fluentd. If the buffer is full, the call to record logs will fail. The default is 8192. (https://github.com/fluent/fluent-logger-golang/tree/master#bufferlimit)π³ --log-opt=fluentd-retry-wait=<1s|1ms>: The time to wait before retrying to send logs to fluentd. The default value is 1s.π³ --log-opt=fluentd-max-retries=<1>: The maximum number of retries to send logs to fluentd. The default value is MaxInt32.π³ --log-opt=fluentd-sub-second-precision=<true|false>: Enable sub-second precision for fluentd. The default value is false.π€ --log-opt=fluentd-async-reconnect-interval=<1s|1ms>: The time to wait before retrying to reconnect to fluentd. The default value is 0s.π€ --log-opt=fluentd-request-ack=<true|false>: Enable request ack for fluentd. The default value is false.
- The
π³ --log-driver=syslog: Writes log messages tosyslog. Thesyslogdaemon must be running on either the host machine or remote.- The
sysloglogging driver supports the following logging options:π³ --log-opt=syslog-address=<ADDRESS>: The address of an externalsyslogserver. The URI specifier may betcp|udp|tcp+tls]://host:port,unix://path, orunixgram://path. If the transport istcp,udp, ortcp+tls, the default port is514.π³ --log-opt=syslog-facility=<FACILITY>: Thesyslogfacility to use. Can be the number or name for any valid syslog facility. See the syslog documentation.π³ --log-opt=syslog-tls-ca-cert=<VALUE>: The absolute path to the trust certificates signed by the CA. Ignored if the address protocol is nottcp+tls.π³ --log-opt=syslog-tls-cert=<VALUE>: The absolute path to the TLS certificate file. Ignored if the address protocol is nottcp+tls.π³ --log-opt=syslog-tls-key=<VALUE>:The absolute path to the TLS key file. Ignored if the address protocol is nottcp+tls.π³ --log-opt=syslog-tls-skip-verify=<VALUE>: If set totrue, TLS verification is skipped when connecting to the daemon. Ignored if the address protocol is nottcp+tls.π³ --log-opt=syslog-format=<VALUE>: Thesyslogmessage format to use. If not specified the local UNIX syslog format is used, without a specified hostname. Specifyrfc3164for the RFC-3164 compatible format,rfc5424for RFC-5424 compatible format, orrfc5424microfor RFC-5424 compatible format with microsecond timestamp resolution.π³ --log-opt=tag=<VALUE>: A string that is appended to theAPP-NAMEin thesyslogmessage. By default, nerdctl uses the first 12 characters of the container ID to tag log messages.
- The
π€ Accepts a LogURI which is a containerd shim logger. A scheme must be specified for the URI. Example:nerdctl run -d --log-driver binary:///usr/bin/ctr-journald-shim docker.io/library/hello-world:latest. An implementation of shim logger can be found at (https://github.com/containerd/containerd/tree/dbef1d56d7ebc05bc4553d72c419ed5ce025b05d/runtime/v2#logging)
Shared memory flags:
π³ --ipc: IPC namespace to useπ³ --shm-size: Size of/dev/shm
GPU flags:
π³ --gpus: GPU devices to add to the container ('all' to pass all GPUs). Please see also ./docs/gpu.md for details.
Ulimit flags:
π³ --ulimit: Set ulimit
Verify flags:
π€ --verify: Verify the image (none|cosign). Seedocs/cosign.mdfor details.π€ --cosign-key: Path to the public key file, KMS, URI or Kubernetes Secret for--verify=cosign
Unimplemented docker run flags:
--attach, --blkio-weight-device, --cpu-rt-*, --detach-keys, --device-*,
--disable-content-trust, --domainname, --expose, --health-*, --ip6, --isolation, --no-healthcheck,
--link*, --mac-address, --publish-all, --sig-proxy, --storage-opt,
--userns, --volume-driver, --volumes-from
π³ π¦ nerdctl exec
Run a command in a running container.
Usage: nerdctl exec [OPTIONS] CONTAINER COMMAND [ARG...]
Flags:
π³ -i, --interactive: Keep STDIN open even if not attachedπ³ -t, --tty: Allocate a pseudo-TTYβ οΈ WIP: currently-tconflicts with-d
π³ -d, --detach: Detached mode: run command in the backgroundπ³ -w, --workdir: Working directory inside the containerπ³ -e, --env: Set environment variablesπ³ --env-file: Set environment variables from fileπ³ --privileged: Give extended privileges to the commandπ³ -u, --user: Username or UID (format: <name|uid>[:<group|gid>])
Unimplemented docker exec flags: --detach-keys
π³ π¦ nerdctl create
Create a new container.
Usage: nerdctl create [OPTIONS] IMAGE [COMMAND] [ARG...]
ipfs:// prefix can be used for IMAGE to pull it from IPFS. See /docs/ipfs.md for details.
The nerdctl create command similar to nerdctl run -d except the container is never started. You can then use the nerdctl start <container_id> command to start the container at any point.
π³ nerdctl cp
Copy files/folders between a running container and the local filesystem
Usage:
nerdctl cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-nerdctl cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH
nerdctl cp is designed only for use with trusted, cooperating containers.
Using nerdctl cp with untrusted or malicious containers is unsupported and may not provide protection against unexpected behavior.
Flags:
π³ -L, --follow-linkAlways follow symbol link in SRC_PATH.
Unimplemented docker cp flags: --archive
π³ π¦ nerdctl ps
List containers.
Usage: nerdctl ps [OPTIONS]
Flags:
π³ -a, --all: Show all containers (default shows just running)π³ --no-trunc: Don't truncate outputπ³ -q, --quiet: Only display container IDsπ³ -s, --size: Display total file sizesπ³ --format: Format the output using the given Go templateπ³ --format=table(default): Tableπ³ --format='{{json .}}': JSONπ€ --format=wide: Wide tableπ€ --format=json: Alias of--format='{{json .}}'
π³ -n, --last: Show n last created containers (includes all states)π³ -l, --latest: Show the latest created container (includes all states)π³ -f, --filter: Filter containers based on given conditionsπ³ --filter id=<value>: Container's ID. Both full ID and truncated ID are supportedπ³ --filter name=<value>: Container's nameπ³ --filter label=<key>=<value>: Arbitrary string either a key or a key-value pairπ³ --filter exited=<value>: Container's exit code. Only work with--allπ³ --filter status=<value>: One ofcreated, running, paused, stopped, exited, pausing, unknown. Note thatrestarting, removing, deadare not supported and will be ignoredπ³ --filter before/since=<ID/name>: Filter containers created before or after a given ID or nameπ³ --filter volume=<value>: Filter by a given mounted volume or bind mountπ³ --filter network=<value>: Filter by a given network
Following arguments for --filter are not supported yet:
--filter ancestor=<value>--filter publish/expose=<port/startport-endport>[/<proto>]--filter health=<value>--filter isolation=<value>--filter is-task=<value>
π³ π¦ nerdctl inspect
Display detailed information on one or more containers.
Usage: nerdctl inspect [OPTIONS] NAME|ID [NAME|ID...]
Flags:
π€ --mode=(dockercompat|native): Inspection mode. "native" produces more information.π³ --format: Format the output using the given Go template, e.g,{{json .}}π³ --type: Return JSON for specified type
Unimplemented docker inspect flags: --size
π³ nerdctl logs
Fetch the logs of a container.
nerdctl run -d are supported.
Usage: nerdctl logs [OPTIONS] CONTAINER
Flags:
π³ --f, --follow: Follow log outputπ³ --since: Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)π³ --until: Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)π³ -t, --timestamps: Show timestampsπ³ -n, --tail: Number of lines to show from the end of the logs (default "all")
Unimplemented docker logs flags: --details
π³ nerdctl port
List port mappings or a specific mapping for the container.
Usage: nerdctl port CONTAINER [PRIVATE_PORT[/PROTO]]
π³ nerdctl rm
Remove one or more containers.
Usage: nerdctl rm [OPTIONS] CONTAINER [CONTAINER...]
Flags:
π³ -f, --force: Force the removal of a running|paused|unknown container (uses SIGKILL)π³ -v, --volumes: Remove anonymous volumes associated with the container
Unimplemented docker rm flags: --link
π³ nerdctl stop
Stop one or more running containers.
Usage: nerdctl stop [OPTIONS] CONTAINER [CONTAINER...]
Flags:
π³ -t, --time=SECONDS: Seconds to wait for stop before killing it (default "10")- Tips: If the init process in container is exited after receiving SIGTERM or exited before the time you specified, the container will be exited immediately
π³ nerdctl start
Start one or more running containers.
Usage: nerdctl start [OPTIONS] CONTAINER [CONTAINER...]
Flags:
π³ -a, --attach: Attach STDOUT/STDERR and forward signals
Unimplemented docker start flags: --checkpoint, --checkpoint-dir, --detach-keys, --interactive
π³ nerdctl restart
Restart one or more running containers.
Usage: nerdctl restart [OPTIONS] CONTAINER [CONTAINER...]
Flags:
π³ -t, --time=SECONDS: Seconds to wait for stop before killing it (default "10")- Tips: If the init process in container is exited after receiving SIGTERM or exited before the time you specified, the container will be exited immediately
π³ nerdctl update
Update configuration of one or more containers.
Usage: nerdctl update [OPTIONS] CONTAINER [CONTAINER...]
π³ --cpus: Number of CPUsπ³ --cpu-quota: Limit the CPU CFS (Completely Fair Scheduler) quotaπ³ --cpu-period: Limit the CPU CFS (Completely Fair Scheduler) periodπ³ --cpu-shares: CPU shares (relative weight)π³ --cpuset-cpus: CPUs in which to allow execution (0-3, 0,1)π³ --cpuset-mems: Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systemsπ³ --memory: Memory limitπ³ --memory-reservation: Memory soft limitπ³ --memory-swap: Swap limit equal to memory plus swap: '-1' to enable unlimited swapπ³ --kernel-memory: Kernel memory limit (deprecated)π³ --pids-limit: Tune container pids limitπ³ --blkio-weight: Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)π³ --restart=(no|always|on-failure|unless-stopped): Restart policy to apply when a container exits
π³ nerdctl wait
Block until one or more containers stop, then print their exit codes.
Usage: nerdctl wait CONTAINER [CONTAINER...]
π³ nerdctl kill
Kill one or more running containers.
Usage: nerdctl kill [OPTIONS] CONTAINER [CONTAINER...]
Flags:
π³ -s, --signal: Signal to send to the container (default: "KILL")
π³ nerdctl pause
Pause all processes within one or more containers.
Usage: nerdctl pause CONTAINER [CONTAINER...]
π³ nerdctl unpause
Unpause all processes within one or more containers.
Usage: nerdctl unpause CONTAINER [CONTAINER...]
π³ docker rename
Rename a container.
Usage: nerdctl rename CONTAINER NEW_NAME
π³ nerdctl container prune
Remove all stopped containers.
Usage: nerdctl container prune [OPTIONS]
Flags:
π³ -f, --force: Do not prompt for confirmation.
Unimplemented docker container prune flags: --filter
Build
π³ nerdctl build
Build an image from a Dockerfile.
nerdctl build with BuildKit.
Usage: nerdctl build [OPTIONS] PATH
Flags:
π€ --buildkit-host=<BUILDKIT_HOST>: BuildKit addressπ³ -t, --tag: Name and optionally a tag in the 'name:tag' formatπ³ -f, --file: Name of the Dockerfileπ³ --target: Set the target build stage to buildπ³ --build-arg: Set build-time variablesπ³ --no-cache: Do not use cache when building the imageπ³ --output=OUTPUT: Output destination (format: type=local,dest=path)π³ type=local,dest=path/to/output-dir: Local directoryπ³ type=oci[,dest=path/to/output.tar]: Docker/OCI dual-format tar ball (compatible withdocker buildx build)π³ type=docker[,dest=path/to/output.tar]: Docker format tar ball (compatible withdocker buildx build)π³ type=tar[,dest=path/to/output.tar]: Raw tar ballπ³ type=image,name=example.com/image,push=true: Push to a registry (seebuildctl builddocumentation)
π³ --progress=(auto|plain|tty): Set type of progress output (auto, plain, tty). Use plain to show container outputπ³ --secret: Secret file to expose to the build: id=mysecret,src=/local/secretπ³ --ssh: SSH agent socket or keys to expose to the build (format:default|<id>[=<socket>|<key>[,<key>]])π³ -q, --quiet: Suppress the build output and print image ID on successπ³ --cache-from=CACHE: External cache sources (eg. user/app:cache, type=local,src=path/to/dir) (compatible withdocker buildx build)π³ --cache-to=CACHE: Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir) (compatible withdocker buildx build)π³ --platform=(amd64|arm64|...): Set target platform for build (compatible withdocker buildx build)π³ --iidfile=FILE: Write the image ID to the fileπ€ --ipfs: Build image with pulling base images from IPFS. See./docs/ipfs.mdfor details.π³ --label: Set metadata for an image
Unimplemented docker build flags: --add-host, --network, --squash
π³ nerdctl commit
Create a new image from a container's changes
Usage: nerdctl commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
Flags:
π³ -a, --author: Author (e.g., "nerdctl contributor nerdctl-dev@example.com")π³ -m, --message: Commit messageπ³ -c, --change: Apply Dockerfile instruction to the created image (supported directives: [CMD, ENTRYPOINT])π³ -p, --pause: Pause container during commit (default: true)
Image management
π³ π¦ nerdctl images
List images
Usage: nerdctl images [OPTIONS] [REPOSITORY[:TAG]]
Flags:
π³ -a, --all: Show all images (unimplemented)π³ -q, --quiet: Only show numeric IDsπ³ --no-trunc: Don't truncate outputπ³ --format: Format the output using the given Go templateπ³ --format=table(default): Tableπ³ --format='{{json .}}': JSONπ€ --format=wide: Wide tableπ€ --format=json: Alias of--format='{{json .}}'
π³ --digests: Show digests (compatible with Docker, unlike ID)π³ -f, --filter: Filter the images. For now, only 'before=image:tag' and 'since=image:tag' is supported.π³ --filter=before=<image:tag>: Images created before given image (exclusive)π³ --filter=since=<image:tag>: Images created after given image (exclusive)π³ --filter=label<key>=<value>: Matches images based on the presence of a label alone or a label and a valueπ€ --filter=reference=<image:tag>: Filter images by reference (Matches both docker compatible wildcard pattern and regexp match)
π€ --names: Show image names
Following arguments for --filter are not supported yet:
--filter=dangling=true: Filter images by dangling
π³ π¦ nerdctl pull
Pull an image from a registry.
Usage: nerdctl pull [OPTIONS] NAME[:TAG|@DIGEST]
ipfs:// prefix can be used for NAME to pull it from IPFS. See /docs/ipfs.md for details.
Flags:
π³ --platform=(amd64|arm64|...): Pull content for a specific platformπ€ Unlike Docker, this flag can be specified multiple times (--platform=amd64 --platform=arm64)
π€ --all-platforms: Pull content for all platformsπ€ --unpack: Unpack the image for the current single platform (auto/true/false)π³ -q, --quiet: Suppress verbose outputπ€ --verify: Verify the image (none|cosign). Seedocs/cosign.mdfor details.π€ --cosign-key: Path to the public key file, KMS, URI or Kubernetes Secret for--verify=cosign
Unimplemented docker pull flags: --all-tags, --disable-content-trust (default true)
π³ nerdctl push
Push an image to a registry.
Usage: nerdctl push [OPTIONS] NAME[:TAG]
ipfs:// prefix can be used for NAME to push it to IPFS. See /docs/ipfs.md for details.
Flags:
π€ --platform=(amd64|arm64|...): Push content for a specific platformπ€ --all-platforms: Push content for all platformsπ€ --sign: Sign the image (none|cosign). Seedocs/cosign.mdfor details.π€ --cosign-key: Path to the private key file, KMS, URI or Kubernetes Secret for--sign=cosignπ€ --allow-nondistributable-artifacts: Allow pushing images with non-distributable blobsπ€ --ipfs-address: Multiaddr of IPFS API (default uses$IPFS_PATHenv variable if defined or local directory~/.ipfs)
Unimplemented docker push flags: --all-tags, --disable-content-trust (default true), --quiet
π³ nerdctl load
Load an image from a tar archive or STDIN.
Usage: nerdctl load [OPTIONS]
Flags:
π³ -i, --input: Read from tar archive file, instead of STDINπ€ --platform=(amd64|arm64|...): Import content for a specific platformπ€ --all-platforms: Import content for all platforms
Unimplemented docker load flags: --quiet
π³ nerdctl save
Save one or more images to a tar archive (streamed to STDOUT by default)
Usage: nerdctl save [OPTIONS] IMAGE [IMAGE...]
Flags:
π³ -o, --output: Write to a file, instead of STDOUTπ€ --platform=(amd64|arm64|...): Export content for a specific platformπ€ --all-platforms: Export content for all platforms
π³ nerdctl tag
Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE.
Usage: nerdctl tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
π³ nerdctl rmi
Remove one or more images
Usage: nerdctl rmi [OPTIONS] IMAGE [IMAGE...]
Flags:
π€ --async: Asynchronous modeπ³ -f, --force: Force removal of the image
Unimplemented docker rmi flags: --no-prune
π³ nerdctl image inspect
Display detailed information on one or more images.
Usage: nerdctl image inspect [OPTIONS] NAME|ID [NAME|ID...]
Flags:
π€ --mode=(dockercompat|native): Inspection mode. "native" produces more information.π³ --format: Format the output using the given Go template, e.g,{{json .}}π€ --platform=(amd64|arm64|...): Inspect a specific platform
π³ nerdctl image history
Show the history of an image.
Usage: nerdctl history [OPTIONS] IMAGE
Flags:
π³ --no-trunc: Don't truncate outputπ³ -q, --quiet: Only display snapshots IDsπ³ --format: Format the output using the given Go template, e.g,{{json .}}
π³ nerdctl image prune
Remove unused images.
nerdctl image prune requires --all to be specified.
Usage: nerdctl image prune [OPTIONS]
Flags:
π³ -a, --all: Remove all unused images, not just dangling onesπ³ -f, --force: Do not prompt for confirmation
Unimplemented docker image prune flags: --filter
π€ nerdctl image convert
Convert an image format.
e.g., nerdctl image convert --estargz --oci example.com/foo:orig example.com/foo:esgz
Usage: nerdctl image convert [OPTIONS] SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Flags:
--estargz: convert legacy tar(.gz) layers to eStargz for lazy pulling. Should be used in conjunction with '--oci'--estargz-record-in=<FILE>: readctr-remote optimize --record-out=<FILE>record file.β οΈ This flag is experimental and subject to change.--estargz-compression-level=<LEVEL>: eStargz compression level (default: 9)--estargz-chunk-size=<SIZE>: eStargz chunk size--estargz-min-chunk-size=<SIZE>: The minimal number of bytes of data must be written in one gzip stream (requires stargz-snapshotter >= v0.13.0). Useful for creating a smaller eStargz image (refer to./docs/stargz.mdfor details).--estargz-external-toc: Separate TOC JSON into another image (called "TOC image"). The name of TOC image is the original + "-esgztoc" suffix. Both eStargz and the TOC image should be pushed to the same registry. (requires stargz-snapshotter >= v0.13.0) Useful for creating a smaller eStargz image (refer to./docs/stargz.mdfor details).β οΈ This flag is experimental and subject to change.--estargz-keep-diff-id: Convert to esgz without changing diffID (cannot be used in conjunction with '--estargz-record-in'. must be specified with '--estargz-external-toc')--zstdchunked: Use zstd compression instead of gzip (a.k.a zstd:chunked). Should be used in conjunction with '--oci'--zstdchunked-record-in=<FILE>: readctr-remote optimize --record-out=<FILE>record file.β οΈ This flag is experimental and subject to change.--zstdchunked-compression-level=<LEVEL>: zstd:chunked compression level (default: 3)--zstdchunked-chunk-size=<SIZE>: zstd:chunked chunk size--uncompress: convert tar.gz layers to uncompressed tar layers--oci: convert Docker media types to OCI media types--platform=<PLATFORM>: convert content for a specific platform--all-platforms: convert content for all platforms (default: false)
π€ nerdctl image encrypt
Encrypt image layers. See ./docs/ocicrypt.md.
Usage: nerdctl image encrypt [OPTIONS] SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Example:
openssl genrsa -out mykey.pem
openssl rsa -in mykey.pem -pubout -out mypubkey.pem
nerdctl image encrypt --recipient=jwe:mypubkey.pem --platform=linux/amd64,linux/arm64 foo example.com/foo:encrypted
nerdctl push example.com/foo:encryptedEnv and Cmd.
To see non-encrypted information, run nerdctl image inspect --mode=native --platform=PLATFORM example.com/foo:encrypted .
Flags:
--recipient=<RECIPIENT>: Recipient of the image is the person who can decrypt (e.g.,jwe:mypubkey.pem)--dec-recipient=<RECIPIENT>: Recipient of the image; used only for PKCS7 and must be an x509 certificate--key=<KEY>[:<PWDDESC>]: A secret key's filename and an optional password separated by colon, PWDDESC=|pass:|fd=|filename--gpg-homedir=<DIR>: The GPG homedir to use; by default gpg uses ~/.gnupg--gpg-version=<VERSION>: The GPG version ("v1" or "v2"), default will make an educated guess--platform=<PLATFORM>: Convert content for a specific platform--all-platforms: Convert content for all platforms (default: false)
π€ nerdctl image decrypt
Decrypt image layers. See ./docs/ocicrypt.md.
Usage: nerdctl image decrypt [OPTIONS] SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Example:
nerdctl pull --unpack=false example.com/foo:encrypted
nerdctl image decrypt --key=mykey.pem example.com/foo:encrypted foo:decryptedFlags:
--dec-recipient=<RECIPIENT>: Recipient of the image; used only for PKCS7 and must be an x509 certificate--key=<KEY>[:<PWDDESC>]: A secret key's filename and an optional password separated by colon, PWDDESC=|pass:|fd=|filename--gpg-homedir=<DIR>: The GPG homedir to use; by default gpg uses ~/.gnupg--gpg-version=<VERSION>: The GPG version ("v1" or "v2"), default will make an educated guess--platform=<PLATFORM>: Convert content for a specific platform--all-platforms: Convert content for all platforms (default: false)
Registry
π³ nerdctl login
Log in to a container registry.
Usage: nerdctl login [OPTIONS] [SERVER]
Flags:
π³ -u, --username: Usernameπ³ -p, --password: Passwordπ³ --password-stdin: Take the password from stdin
π³ nerdctl logout
Log out from a container registry
Usage: nerdctl logout [SERVER]
Network management
π³ nerdctl network create
Create a network
Usage: nerdctl network create [OPTIONS] NETWORK
Flags:
π³ -d, --driver=(bridge|nat|macvlan|ipvlan): Driver to manage the Networkπ³ --driver=bridge: Default driver for unixπ³ --driver=macvlan: Macvlan network driver for unixπ³ --driver=ipvlan: IPvlan network driver for unixπ³ π¦ --driver=nat: Default driver for windows
π³ -o, --opt: Set driver specific optionsπ³ --opt=com.docker.network.driver.mtu=<MTU>: Set the containers network MTUπ€ --opt=mtu=<MTU>: Alias of--opt=com.docker.network.driver.mtu=<MTU>π³ --opt=macvlan_mode=(bridge)>: Set macvlan network mode (default: bridge)π³ --opt=ipvlan_mode=(l2|l3): Set IPvlan network mode (default: l2)π€ --opt=mode=(bridge|l2|l3): Alias of--opt=macvlan_mode=(bridge)and--opt=ipvlan_mode=(l2|l3)π³ --opt=parent=<INTERFACE>: Set valid parent interface on host
π³ --ipam-driver=(default|host-local|dhcp): IP Address Management Driverπ³ π¦ --ipam-driver=default: Default IPAM driverπ€ --ipam-driver=host-local: Host-local IPAM driver for unixπ€ --ipam-driver=dhcp: DHCP IPAM driver for unix, requires root
π³ --ipam-opt: Set IPAM driver specific optionsπ³ --subnet: Subnet in CIDR format that represents a network segment, e.g. "10.5.0.0/16"π³ --gateway: Gateway for the master subnetπ³ --ip-range: Allocate container ip from a sub-rangeπ³ --label: Set metadata on a network
Unimplemented docker network create flags: --attachable, --aux-address, --config-from, --config-only, --ingress, --internal, --ipv6, --scope
π³ nerdctl network ls
List networks
Usage: nerdctl network ls [OPTIONS]
Flags:
π³ -q, --quiet: Only display network IDsπ³ --format: Format the output using the given Go templateπ³ --format=table(default): Tableπ³ --format='{{json .}}': JSONπ€ --format=wide: Alias of--format=tableπ€ --format=json: Alias of--format='{{json .}}'
Unimplemented docker network ls flags: --filter, --no-trunc
π³ nerdctl network inspect
Display detailed information on one or more networks
Usage: nerdctl network inspect [OPTIONS] NETWORK [NETWORK...]
Flags:
π³ --format: Format the output using the given Go template, e.g,{{json .}}π€ --mode=(dockercompat|native): Inspection mode. "native" produces more information.
Unimplemented docker network inspect flags: --verbose
π³ nerdctl network rm
Remove one or more networks by name or identifier
:warning network removal will fail if there are containers attached to it.
Usage: nerdctl network rm NETWORK [NETWORK...]
π³ nerdctl network prune
Remove all unused networks
Usage: nerdctl network prune [OPTIONS]
Flags:
π³ -f, --force: Do not prompt for confirmation
Unimplemented docker network prune flags: --filter
Volume management
π³ nerdctl volume create
Create a volume
Usage: nerdctl volume create [OPTIONS] [VOLUME]
Flags:
π³ --label: Set metadata for a volume
Unimplemented docker volume create flags: --driver, --opt
π³ nerdctl volume ls
List volumes
Usage: nerdctl volume ls [OPTIONS]
Flags:
π³ -q, --quiet: Only display volume namesπ³ --format: Format the output using the given Go templateπ³ --format=table(default): Tableπ³ --format='{{json .}}': JSONπ€ --format=wide: Alias of--format=tableπ€ --format=json: Alias of--format='{{json .}}'
π€ --size: Display the disk usage of volumes.π³ -f, --filter: Filter volumes based on given conditions.π³ --filter label=<key>=<value>: Matches volumes by label on bothkeyandvalue. Ifvalueis left empty, matches all volumes withkeyregardless of its valueπ³ --filter name=<value>: Matches all volumes with a name containing thevaluestringπ€ --filter "size=<value>": Matches all volumes with a size meets thevalue.sizeoperand can be>=, <=, >, <, =andvaluemust be an integer. Quotes should be used otherwise some shells may treat operand as redirections
Following arguments for --filter are not supported yet:
--filter=dangling=true: Filter volumes by dangling--filter=driver=local: Filter volumes by driver
π³ nerdctl volume inspect
Display detailed information on one or more volumes
Usage: nerdctl volume inspect [OPTIONS] VOLUME [VOLUME...]
Flags:
π³ --format: Format the output using the given Go template, e.g,{{json .}}π€ --size: Displays disk usage of volume
π³ nerdctl volume rm
Remove one or more volumes
Usage: nerdctl volume rm [OPTIONS] VOLUME [VOLUME...]
π³ -f, --force: Force the removal of one or more volumes
π³ nerdctl volume prune
Remove all unused local volumes
Usage: nerdctl volume prune [OPTIONS]
Flags:
π³ -f, --force: Do not prompt for confirmation
Unimplemented docker volume prune flags: --filter
Namespace management
π€ π¦ nerdctl namespace create
Create a new namespace.
Usage: nerdctl namespace create NAMESPACE
Flags:
--label: Set labels for a namespace
π€ π¦ nerdctl namespace inspect
Inspect a namespace.
Usage: nerdctl namespace inspect NAMESPACE
π€ π¦ nerdctl namespace ls
List containerd namespaces such as "default", "moby", or "k8s.io".
Usage: nerdctl namespace ls [OPTIONS]
Flags:
-q, --quiet: Only display namespace names
π€ π¦ nerdctl namespace remove
Remove one or more namespaces.
Usage: nerdctl namespace remove [OPTIONS] NAMESPACE [NAMESPACE...]
Flags:
-c, --cgroup: delete the namespace's cgroup
π€ π¦ nerdctl namespace update
Udapte labels for a namespace.
Usage: nerdctl namespace update NAMESPACE
Flags:
--label: Set labels for a namespace
AppArmor profile management
π€ nerdctl apparmor inspect
Display the default AppArmor profile "nerdctl-default". Other profiles cannot be displayed with this command.
Usage: nerdctl apparmor inspect
π€ nerdctl apparmor load
Load the default AppArmor profile "nerdctl-default". Requires root.
Usage: nerdctl apparmor load
π€ nerdctl apparmor ls
List the loaded AppArmor profile
Usage: nerdctl apparmor ls [OPTIONS]
Flags:
-q, --quiet: Only display volume names--format: Format the output using the given Go template, e.g,{{json .}}
π€ nerdctl apparmor unload
Unload an AppArmor profile. The target profile name defaults to "nerdctl-default". Requires root.
Usage: nerdctl apparmor unload [PROFILE]
Builder management
π³ nerdctl builder prune
Clean up BuildKit build cache.
Usage: nerdctl builder prune
Flags:
π€ --buildkit-host=<BUILDKIT_HOST>: BuildKit address
π€ nerdctl builder debug
Interactive debugging of Dockerfile using buildg.
Please refer to ./docs/builder-debug.md for details.
This is an experimental feature.
buildkitd daemon but uses the patched version of BuildKit provided by buildg. This should be fixed in the future.
Usage: nerdctl builder debug PATH
Flags:
π€ -f,--file: Name of the Dockerfileπ€ --image: Image to use for debugging stageπ€ --target: Set the target build stage to buildπ€ --build-arg: Set build-time variables
Unimplemented docker builder prune flags: --all, --filter, --force, --keep-storage
System
π³ nerdctl events
Get real time events from the server.
Usage: nerdctl events [OPTIONS]
Flags:
π³ --format: Format the output using the given Go template, e.g,{{json .}}
Unimplemented docker events flags: --filter, --since, --until
π³ nerdctl info
Display system-wide information
Usage: nerdctl info [OPTIONS]
Flags:
π³ -f, --format: Format the output using the given Go template, e.g,{{json .}}π€ --mode=(dockercompat|native): Information mode. "native" produces more information.
π³ nerdctl version
Show the nerdctl version information
Usage: nerdctl version [OPTIONS]
Flags:
π³ -f, --format: Format the output using the given Go template, e.g,{{json .}}
π³ nerdctl system prune
Remove unused data
nerdctl system prune requires --all to be specified.
Usage: nerdctl system prune [OPTIONS]
Flags:
π³ -a, --all: Remove all unused images, not just dangling onesπ³ -f, --force: Do not prompt for confirmationπ³ --volumes: Prune volumes
Unimplemented docker system prune flags: --filter
Stats
π³ nerdctl stats
Display a live stream of container(s) resource usage statistics.
Usage: nerdctl stats [OPTIONS]
Flags:
π³ -a, --all: Show all containers (default shows just running)π³ --format=FORMAT: Pretty-print images using a Go template, e.g.,{{json .}}π³ --no-stream: Disable streaming stats and only pull the first resultπ³ --no-trunc: Do not truncate output
π³ nerdctl top
Display the running processes of a container.
Usage: nerdctl top CONTAINER [ps OPTIONS]
Shell completion
π€ nerdctl completion bash
Generate the autocompletion script for bash.
Usage: add the following line to ~/.bash_profile:
source <(nerdctl completion bash)Or run nerdctl completion bash > /etc/bash_completion.d/nerdctl as the root.
π€ nerdctl completion zsh
Generate the autocompletion script for zsh.
Usage: see nerdctl completion zsh --help
π€ nerdctl completion fish
Generate the autocompletion script for fish.
Usage: see nerdctl completion fish --help
π€ nerdctl completion powershell
Generate the autocompletion script for powershell.
Usage: see nerdctl completion powershell --help
Compose
π³ nerdctl compose
Compose
Usage: nerdctl compose [OPTIONS] [COMMAND]
Flags:
π³ -f, --file: Specify an alternate compose fileπ³ -p, --project-name: Specify an alternate project name
π³ nerdctl compose up
Create and start containers
Usage: nerdctl compose up [OPTIONS] [SERVICE...]
Flags:
π³ -d, --detach: Detached mode: Run containers in the backgroundπ³ --no-build: Don't build an image, even if it's missing.π³ --no-color: Produce monochrome outputπ³ --no-log-prefix: Don't print prefix in logsπ³ --build: Build images before starting containers.π€ --ipfs: Build images with pulling base images from IPFS. See./docs/ipfs.mdfor details.π³ --quiet-pull: Pull without printing progress informationπ³ --scale: Scale SERVICE to NUM instances. Overrides thescalesetting in the Compose file if present.π³ --remove-orphans: Remove containers for services not defined in the Compose file
Unimplemented docker-compose up (V1) flags: --no-deps, --force-recreate, --always-recreate-deps, --no-recreate,
--no-start, --abort-on-container-exit, --attach-dependencies, --timeout, --renew-anon-volumes, --exit-code-from
Unimplemented docker compose up (V2) flags: --environment
π³ nerdctl compose logs
Create and start containers
Usage: nerdctl compose logs [OPTIONS] [SERVICE...]
Flags:
π³ --no-color: Produce monochrome outputπ³ --no-log-prefix: Don't print prefix in logsπ³ --timestamps: Show timestampsπ³ --tail: Number of lines to show from the end of the logs
Unimplemented docker compose logs (V2) flags: --since, --until
π³ nerdctl compose build
Build or rebuild services.
Usage: nerdctl compose build [OPTIONS] [SERVICE...]
Flags:
π³ --build-arg: Set build-time variables for servicesπ³ --no-cache: Do not use cache when building the imageπ³ --progress: Set type of progress output (auto, plain, tty). Use plain to show container outputπ€ --ipfs: Build images with pulling base images from IPFS. See./docs/ipfs.mdfor details.
Unimplemented docker-compose build (V1) flags: --compress, --force-rm, --memory, --no-rm, --parallel, --pull, --quiet
π³ nerdctl compose create
Creates containers for one or more services.
Usage: nerdctl compose create [OPTIONS] [SERVICE...]
Flags:
π³ --build: Build images before starting containersπ³ --force-recreate: Recreate containers even if their configuration and image haven't changedπ³ --no-build: Don't build an image even if it's missing, conflict with--buildπ³ --no-recreate: Don't recreate containers if they exist, conflict with--force-recreateπ³ --pull: Pull images before running. (support always|missing|never) (default "missing")
π³ nerdctl compose exec
Execute a command on a running container of the service.
Usage: nerdctl compose exec [OPTIONS] SERVICE COMMAND [ARGS...]
Flags:
π³ -d, --detach: Detached mode: Run the command in backgroundπ³ -e, --env: Set environment variablesπ³ --index: Set index of the container if the service has multiple instances. (default 1)π³ -i, --interactive: Keep STDIN open even if not attached (default true)π³ --privileged: Give extended privileges to the commandπ³ -t, --tty: Allocate a pseudo-TTYπ³ -u, --user: Username or UID (format:<name|uid>[:<group|gid>])π³ -w, --workdir: Working directory inside the container
Unimplemented docker-compose exec (V2) flags: -T, --no-TTY
π³ nerdctl compose down
Remove containers and associated resources
Usage: nerdctl compose down [OPTIONS]
Flags:
π³ -v, --volumes: Remove named volumes declared in the volumes section of the Compose file and anonymous volumes attached to containersπ³ --remove-orphans: Remove containers of services not defined in the Compose file.
Unimplemented docker-compose down (V1) flags: --rmi, --timeout
π³ nerdctl compose images
List images used by created containers in services
Usage: nerdctl compose images [OPTIONS] [SERVICE...]
Flags:
π³ -q, --quiet: Only show numeric image IDs
π³ nerdctl compose start
Start existing containers for service(s)
Usage: nerdctl compose start [SERVICE...]
π³ nerdctl compose stop
Stop containers in services without removing them.
Usage: nerdctl compose stop [OPTIONS] [SERVICE...]
Flags:
π³ -t, --timeout: Seconds to wait for stop before killing it (default 10)
π³ nerdctl compose port
Print the public port for a port binding of a service container
Usage: nerdctl compose port [OPTIONS] SERVICE PRIVATE_PORT
Flags:
π³ --index: Index of the container if the service has multiple instances. (default 1)π³ --protocol: Protocol of the port (tcp|udp) (default "tcp")
π³ nerdctl compose ps
List containers of services
Usage: nerdctl compose ps [OPTIONS] [SERVICE...]
Unimplemented docker-compose ps (V1) flags: --quiet, --services, --filter, --all
Unimplemented docker compose ps (V2) flags: --status
π³ nerdctl compose pull
Pull service images
Usage: nerdctl compose pull [OPTIONS] [SERVICE...]
Flags:
π³ -q, --quiet: Pull without printing progress information
Unimplemented docker-compose pull (V1) flags: --ignore-pull-failures, --parallel, --no-parallel, include-deps
π³ nerdctl compose push
Push service images
Usage: nerdctl compose push [OPTIONS] [SERVICE...]
Unimplemented docker-compose pull (V1) flags: --ignore-push-failures
π³ nerdctl compose pause
Pause all processes within containers of service(s). They can be unpaused with nerdctl compose unpause
Usage: nerdctl compose pause [SERVICE...]
π³ nerdctl compose unpause
Unpause all processes within containers of service(s)
Usage: nerdctl compose unpause [SERVICE...]
π³ nerdctl compose config
Validate and view the Compose file
Usage: nerdctl compose config
Flags:
π³ -q, --quiet: Pull without printing progress informationπ³ --services: Print the service names, one per line.π³ --volumes: Print the volume names, one per line.π³ --hash="*": Print the service config hash, one per line.
Unimplemented docker-compose config (V1) flags: --resolve-image-digests, --no-interpolate
Unimplemented docker compose config (V2) flags: --resolve-image-digests, --no-interpolate, --format, --output, --profiles
π³ nerdctl compose kill
Force stop service containers
Usage: nerdctl compose kill [OPTIONS] [SERVICE...]
Flags:
π³ -s, --signal: SIGNAL to send to the container (default: "SIGKILL")
π³ nerdctl compose restart
Restart containers of given (or all) services
Usage: nerdctl compose restart [OPTIONS] [SERVICE...]
Flags:
π³ -t, --timeout: Seconds to wait before restarting it (default 10)
π³ nerdctl compose rm
Remove stopped service containers
Usage: nerdctl compose rm [OPTIONS] [SERVICE...]
Flags:
π³ -f, --force: Don't prompt for confirmation (different with-finnerdctl rmwhich means force deletion).π³ -s, --stop: Stop containers before removing.π³ -v, --volumes: Remove anonymous volumes associated with the container.
π³ nerdctl compose run
Run a one-off command on a service
Usage: nerdctl compose run [OPTIONS] SERVICE [COMMAND] [ARGS...]
Unimplemented docker-compose run (V1) flags: --use-aliases, --no-TTY
Unimplemented docker compose run (V2) flags: --use-aliases, --no-TTY, --tty
π³ nerdctl compose top
Display the running processes of service containers
Usage: nerdctl compose top [SERVICES...]
π³ nerdctl compose version
Show the Compose version information (which is the nerdctl version)
Usage: nerdctl compose version
Flags:
π³ -f, --format: Format the output. Values: [pretty | json] (default "pretty")π³ --short: Shows only Compose's version number
IPFS management
P2P image distribution (IPFS) is completely optional. Your host is NOT connected to any P2P network, unless you opt in to install and run IPFS daemon.
π€ nerdctl ipfs registry serve
Serve read-only registry backed by IPFS on localhost.
This is needed to run nerdctl build with pulling base images from IPFS.
Other commands (e.g. nerdctl push ipfs://<image-name> and nerdctl pull ipfs://<CID>) don't require this.
You need to install ipfs command on the host.
See ./docs/ipfs.md for details.
Usage: nerdctl ipfs registry serve [OPTIONS]
Flags:
π€ --ipfs-address: Multiaddr of IPFS API (default is pulled from$IPFS_PATH/apifile. If$IPFS_PATHenv var is not present, it defaults to~/.ipfs).π€ --listen-registry: Address to listen (defaultlocalhost:5050).π€ --read-retry-num: Times to retry query on IPFS (default 0 (no retry))π€ --read-timeout: Timeout duration of a read request to IPFS (default 0 (no timeout))
Global flags
π€ π¦ --address: containerd address, optionally with "unix://" prefixπ€ π¦ -a,--host,-H: deprecated aliases of--addressπ€ π¦ --namespace: containerd namespaceπ€ π¦ -n: deprecated alias of--namespaceπ€ π¦ --snapshotter: containerd snapshotterπ€ π¦ --storage-driver: deprecated alias of--snapshotterπ€ π¦ --cni-path: CNI binary path (default:/opt/cni/bin) [$CNI_PATH]π€ π¦ --cni-netconfpath: CNI netconf path (default:/etc/cni/net.d) [$NETCONFPATH]π€ π¦ --data-root: nerdctl data root, e.g. "/var/lib/nerdctl"π€ --cgroup-manager=(cgroupfs|systemd|none): cgroup manager- Default: "systemd" on cgroup v2 (rootful & rootless), "cgroupfs" on v1 rootful, "none" on v1 rootless
π€ --insecure-registry: skips verifying HTTPS certs, and allows falling back to plain HTTP
The global flags can be also specified in /etc/nerdctl/nerdctl.toml (rootful) and ~/.config/nerdctl/nerdctl.toml (rootless).
See ./docs/config.md.
Unimplemented Docker commands
Container management:
docker attachdocker diffdocker checkpoint *
Image:
docker exportanddocker importdocker trust *(Instead, nerdctl supportsnerdctl pull --verify=cosignandnerdctl push --sign=cosign. See./docs/cosign.md.)docker manifest *
Network management:
docker network connectdocker network disconnect
Registry:
docker search
Compose:
docker-compose events|scale
Others:
docker system dfdocker context- Swarm commands are unimplemented and will not be implemented:
docker swarm|node|service|config|secret|stack * - Plugin commands are unimplemented and will not be implemented:
docker plugin *
Additional documents
Configuration guide:
./docs/config.md: Configuration (/etc/nerdctl/nerdctl.toml,~/.config/nerdctl/nerdctl.toml)./docs/registry.md: Registry authentication (~/.docker/config.json)
Basic features:
./docs/compose.md: Compose./docs/rootless.md: Rootless mode./docs/cni.md: CNI for containers network./docs/build.md:nerdctl buildwith BuildKit
Advanced features:
./docs/stargz.md: Lazy-pulling using Stargz Snapshotter./docs/nydus.md: Lazy-pulling using Nydus Snapshotter./docs/overlaybd.md: Lazy-pulling using OverlayBD Snapshotter./docs/ocicrypt.md: Running encrypted images./docs/gpu.md: Using GPUs inside containers./docs/multi-platform.md: Multi-platform mode
Experimental features:
./docs/experimental.md: Experimental features./docs/freebsd.md: Running FreeBSD jails./docs/ipfs.md: Distributing images on IPFS./docs/builder-debug.md: Interactive debugging of Dockerfile
Implementation details:
./docs/dir.md: Directory layout (/var/lib/nerdctl)
Misc:
./docs/faq.md: FAQs and Troubleshooting