Skip to content

Latest commit

 

History

History
1747 lines (1187 loc) · 75.8 KB

command-reference.md

File metadata and controls

1747 lines (1187 loc) · 75.8 KB

Command reference

🐳 = Docker compatible

🤓 = nerdctl specific

🟦 = Windows enabled

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

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 ipfs.md for details. :nerd_face: oci-archive:// prefix can be used for IMAGE to specify a local file system path to an OCI formatted tarball.

Basic flags:

  • 🐳 -a, --attach: Attach STDIN, STDOUT, or STDERR
  • 🐳 🟦 -i, --interactive: Keep STDIN open even if not attached"
  • 🐳 🟦 -t, --tty: Allocate a pseudo-TTY
    • ⚠️ WIP: currently -t conflicts with -d
  • 🐳 -sig-proxy: Proxy received signals to the process (default true)
  • 🐳 🟦 -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"
  • 🐳 -q, --quiet: Suppress the pull output
  • 🐳 --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
  • 🐳 --detach-keys: Override the default detach keys

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 your PATH.
    • Default: tini

Isolation flags:

  • 🐳 🟦 🤓 --isolation=(default|process|host|hyperv): Used on Windows to change process isolation level. default will use the runtime options configured in default_runtime in the containerd configuration which is process in containerd by default. process runs process isolated containers. host runs Host Process containers. Host process containers inherit permissions from containerd process unless --user is specified then will start with user specified and the user specified must be present on the host. host requires Containerd 1.7+. hyperv runs Hyper-V hypervisor partition-based isolated containers. Not implemented for Linux.

Network flags:

  • 🐳 --net, --network=(bridge|host|none|container:<container>|ns:<path>|<CNI>): Connect a container to a network.
    • Default: "bridge"
    • container:<name|id>: reuse another container's network stack, container has to be precreated.
    • 🤓 ns:<path>: run inside an existing network namespace
    • 🤓 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 could be a special string host-gateway,
  • which will be resolved to the host-gateway-ip in nerdctl.toml or global flag.
  • 🐳 --ip: Specific static IP address(es) to use. Note that unlike docker, nerdctl allows specifying it with the default bridge network.
  • 🐳 --ip6: Specific static IP6 address(es) to use. Should be used with user networks
  • 🐳 --mac-address: Specific MAC address to use. Be aware that it does not check if manually specified MAC addresses are unique. Supports network type bridge and macvlan

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 systempaths=unconfined: Turn off confinement for system paths (masked paths, read-only paths) for the container
  • 🤓 --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
  • 🤓 --systemd=(true|false|always): Enable systemd compatibility (default: false).
    • Default: "false"
    • true: Enable systemd compatibility is enabled if the entrypoint executable matches one of the following paths:
      • /sbin/init
      • /usr/sbin/init
      • /usr/local/sbin/init
    • always: Always enable systemd compatibility

Corresponds to Podman CLI.

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
    • 🐳 option rw : Read/Write (when writable)
    • 🐳 option ro : Non-recursive read-only
    • 🤓 option rro: Recursive read-only. Should be used in conjunction with rprivate. e.g., -v /mnt:/mnt:rro,rprivate makes children such as /mnt/usb to be read-only, too. Requires kernel >= 5.12, and crun >= 1.4 or runc >= 1.1 (PR #3272). With older runc, rro just works as ro.
    • 🐳 option shared, slave, private: Non-recursive "shared" / "slave" / "private" propagation
    • 🐳 option rshared, rslave, rprivate: Recursive "shared" / "slave" / "private" propagation
    • 🤓 option bind: Not-recursively bind-mounted
    • 🤓 option rbind: 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 are bind, volume, tmpfs. The default type will be set to volume if not specified. i.e., --mount src=vol-1,dst=/app,readonly equals --mount type=volume,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 permissions.
    • Options specific to bind:
      • 🐳 bind-propagation: shared, slave, private, rshared, rslave, or rprivate(default).
      • 🐳 bind-nonrecursive: true or false(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 to 1777 or world-writable.
    • Options specific to volume:
      • unimplemented options: volume-nocopy, volume-label, volume-driver, volume-opt
  • 🐳 --volumes-from: Mount volumes from the specified container(s), e.g. "--volumes-from my-container".

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 (Not passed through the OCI runtime since nerdctl v2.0, with an exception for nerdctl/bypass4netns)
  • 🐳 🟦 --label-file: Read in a line delimited file of labels
  • 🐳 🟦 --annotation: Add an annotation to the container (passed through to the OCI runtime)
  • 🐳 🟦 --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 (default json-file).
    • 🐳 --log-driver=json-file: The logs are formatted as JSON. The default logging driver for nerdctl.
      • The json-file logging 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 when max-size is 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
    • 🐳 --log-driver=journald: Writes log messages to journald. The journald daemon must be running on the host machine.
      • 🐳 --log-opt=tag=<TEMPLATE>: Specify template to set SYSLOG_IDENTIFIER value in journald logs.
    • 🐳 --log-driver=fluentd: Writes log messages to fluentd. The fluentd daemon must be running on the host machine.
      • The fluentd logging driver supports the following logging options:
        • 🐳 --log-opt=fluentd-address=<ADDRESS>: The address of the fluentd daemon, 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.
    • 🐳 --log-driver=syslog: Writes log messages to syslog. The syslog daemon must be running on either the host machine or remote.
      • The syslog logging driver supports the following logging options:
        • 🐳 --log-opt=syslog-address=<ADDRESS>: The address of an external syslog server. The URI specifier may be tcp|udp|tcp+tls]://host:port, unix://path, or unixgram://path. If the transport is tcp, udp, or tcp+tls, the default port is 514.
        • 🐳 --log-opt=syslog-facility=<FACILITY>: The syslog facility 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 not tcp+tls.
        • 🐳 --log-opt=syslog-tls-cert=<VALUE>: The absolute path to the TLS certificate file. Ignored if the address protocol is not tcp+tls.
        • 🐳 --log-opt=syslog-tls-key=<VALUE>:The absolute path to the TLS key file. Ignored if the address protocol is not tcp+tls.
        • 🐳 --log-opt=syslog-tls-skip-verify=<VALUE>: If set to true, TLS verification is skipped when connecting to the daemon. Ignored if the address protocol is not tcp+tls.
        • 🐳 --log-opt=syslog-format=<VALUE>: The syslog message format to use. If not specified the local UNIX syslog format is used, without a specified hostname. Specify rfc3164 for the RFC-3164 compatible format, rfc5424 for RFC-5424 compatible format, or rfc5424micro for RFC-5424 compatible format with microsecond timestamp resolution.
        • 🐳 --log-opt=tag=<VALUE>: A string that is appended to the APP-NAME in the syslog message. By default, nerdctl uses the first 12 characters of the container ID to tag log messages.
    • 🤓 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=(host|private|shareable|container:<container>): IPC namespace to use and mount /dev/shm. Default: "private". Only implemented on Linux.
  • 🐳 --shm-size: Size of /dev/shm

GPU flags:

  • 🐳 --gpus: GPU devices to add to the container ('all' to pass all GPUs). Please see also ./gpu.md for details.

Ulimit flags:

  • 🐳 --ulimit: Set ulimit

Verify flags:

  • 🤓 --verify: Verify the image (none|cosign|notation). See ./cosign.md and ./notation.md for details.
  • 🤓 --cosign-key: Path to the public key file, KMS, URI or Kubernetes Secret for --verify=cosign
  • 🤓 --cosign-certificate-identity: The identity expected in a valid Fulcio certificate for --verify=cosign. Valid values include email address, DNS names, IP addresses, and URIs. Either --cosign-certificate-identity or --cosign-certificate-identity-regexp must be set for keyless flows
  • 🤓 --cosign-certificate-identity-regexp: A regular expression alternative to --cosign-certificate-identity for --verify=cosign. Accepts the Go regular expression syntax described at https://golang.org/s/re2syntax. Either --cosign-certificate-identity or --cosign-certificate-identity-regexp must be set for keyless flows
  • 🤓 --cosign-certificate-oidc-issuer: The OIDC issuer expected in a valid Fulcio certificate for --verify=cosign,, e.g. https://token.actions.githubusercontent.com or https://oauth2.sigstore.dev/auth. Either --cosign-certificate-oidc-issuer or --cosign-certificate-oidc-issuer-regexp must be set for keyless flows
  • 🤓 --cosign-certificate-oidc-issuer-regexp: A regular expression alternative to --certificate-oidc-issuer for --verify=cosign,. Accepts the Go regular expression syntax described at https://golang.org/s/re2syntax. Either --cosign-certificate-oidc-issuer or --cosign-certificate-oidc-issuer-regexp must be set for keyless flows

IPFS flags:

  • 🤓 --ipfs-address: Multiaddr of IPFS API (default uses $IPFS_PATH env variable if defined or local directory ~/.ipfs)

Unimplemented docker run flags: --blkio-weight-device, --cpu-rt-*, --device-*, --disable-content-trust, --domainname, --expose, --health-*, --isolation, --no-healthcheck, --link*, --publish-all, --storage-opt, --userns, --volume-driver

🐳 🟦 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 -t conflicts 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 ipfs.md for details. :nerd_face: oci-archive:// prefix can be used for IMAGE to specify a local file system path to an OCI formatted tarball.

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-link Always 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. When specifying the condition 'status', it filters all containers
    • 🐳 --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 of created, running, paused, stopped, exited, pausing, unknown. Note that restarting, removing, dead are not supported and will be ignored. When specifying this condition, it filters all containers.
    • 🐳 --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:

  1. --filter ancestor=<value>
  2. --filter publish/expose=<port/startport-endport>[/<proto>]
  3. --filter health=<value>
  4. --filter isolation=<value>
  5. --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
  • 🐳 --size: Display total file sizes if the type is container

Unimplemented docker inspect flags: --size

🐳 nerdctl logs

Fetch the logs of a container.

⚠️ Currently, only containers created with 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
  • 🐳 --detach-keys: Override the default detach keys

Unimplemented docker start flags: --checkpoint, --checkpoint-dir, --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...]

🐳 nerdctl rename

Rename a container.

Usage: nerdctl rename CONTAINER NEW_NAME

🐳 nerdctl attach

Attach stdin, stdout, and stderr to a running container. For example:

  1. nerdctl run -it --name test busybox to start a container with a pty
  2. ctrl-p ctrl-q to detach from the container
  3. nerdctl attach test to attach to the container

Caveats:

  • Currently only one attach session is allowed. When the second session tries to attach, currently no error will be returned from nerdctl. However, since behind the scenes, there's only one FIFO for stdin, stdout, and stderr respectively, if there are multiple sessions, all the sessions will be reading from and writing to the same 3 FIFOs, which will result in mixed input and partial output.
  • Until dual logging (issue #1946) is implemented, a container that is spun up by either nerdctl run -d or nerdctl start (without --attach) cannot be attached to.

Usage: nerdctl attach CONTAINER

Flags:

  • 🐳 --detach-keys: Override the default detach keys

Unimplemented docker attach flags: --no-stdin, --sig-proxy

🐳 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

🐳 nerdctl diff

Inspect changes to files or directories on a container's filesystem

Usage: nerdctl diff CONTAINER

Build

🐳 nerdctl build

Build an image from a Dockerfile.

ℹ️ Needs buildkitd to be running. See also the document about setting up 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 with docker buildx build)
    • 🐳 type=docker[,dest=path/to/output.tar]: Docker format tar ball (compatible with docker buildx build)
    • 🐳 type=tar[,dest=path/to/output.tar]: Raw tar ball
    • 🐳 type=image,name=example.com/image,push=true: Push to a registry (see buildctl build documentation)
  • 🐳 --progress=(auto|plain|tty): Set type of progress output (auto, plain, tty). Use plain to show container output
  • 🐳 --provenance: Shorthand for "--attest=type=provenance", see buildx_build.md documentation
  • 🐳 --pull=(true|false): On true, always attempt to pull latest image version from remote. Default uses buildkit's default.
  • 🐳 --secret: Secret file to expose to the build: id=mysecret,src=/local/secret
  • 🐳 --allow: Allow extra privileged entitlement, e.g. network.host, security.insecure (It’s required to configure the buildkitd to enable the feature, see buildkitd.toml documentation)
  • 🐳 --attest: Attestation parameters (format: "type=sbom,generator=image"), see buildx_build.md documentation
  • 🐳 --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
  • 🐳 --sbom: Shorthand for "--attest=type=sbom", see buildx_build.md documentation
  • 🐳 --cache-from=CACHE: External cache sources (eg. user/app:cache, type=local,src=path/to/dir) (compatible with docker buildx build)
  • 🐳 --cache-to=CACHE: Cache export destinations (eg. user/app:cache, type=local,dest=path/to/dir) (compatible with docker buildx build)
  • 🐳 --platform=(amd64|arm64|...): Set target platform for build (compatible with docker buildx build)
  • 🐳 --iidfile=FILE: Write the image ID to the file
  • 🤓 --ipfs: Build image with pulling base images from IPFS. See ipfs.md for details.
  • 🐳 --label: Set metadata for an image
  • 🐳 --network=(default|host|none): Set the networking mode for the RUN instructions during build.(compatible with buildctl build)
  • 🐳 --build-context: Set additional contexts for build (e.g. dir2=/path/to/dir2, myorg/myapp=docker-image://path/to/myorg/myapp)

Unimplemented docker build flags: --add-host, --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

⚠️ The image ID is usually different from Docker image ID.

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.
    • 🐳 --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=dangling=true: Filter images by dangling
    • 🤓 --filter=reference=<image:tag>: Filter images by reference (Matches both docker compatible wildcard pattern and regexp match)
  • 🤓 --names: Show image names

🐳 🟦 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 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|notation). See ./cosign.md and ./notation.md for details.
  • 🤓 --cosign-key: Path to the public key file, KMS, URI or Kubernetes Secret for --verify=cosign
  • 🤓 --cosign-certificate-identity: The identity expected in a valid Fulcio certificate for --verify=cosign. Valid values include email address, DNS names, IP addresses, and URIs. Either --cosign-certificate-identity or --cosign-certificate-identity-regexp must be set for keyless flows
  • 🤓 --cosign-certificate-identity-regexp: A regular expression alternative to --cosign-certificate-identity for --verify=cosign. Accepts the Go regular expression syntax described at https://golang.org/s/re2syntax. Either --cosign-certificate-identity or --cosign-certificate-identity-regexp must be set for keyless flows
  • 🤓 --cosign-certificate-oidc-issuer: The OIDC issuer expected in a valid Fulcio certificate for --verify=cosign,, e.g. https://token.actions.githubusercontent.com or https://oauth2.sigstore.dev/auth. Either --cosign-certificate-oidc-issuer or --cosign-certificate-oidc-issuer-regexp must be set for keyless flows
  • 🤓 --cosign-certificate-oidc-issuer-regexp: A regular expression alternative to --certificate-oidc-issuer for --verify=cosign,. Accepts the Go regular expression syntax described at https://golang.org/s/re2syntax. Either --cosign-certificate-oidc-issuer or --cosign-certificate-oidc-issuer-regexp must be set for keyless flows
  • 🤓 --ipfs-address: Multiaddr of IPFS API (default uses $IPFS_PATH env variable if defined or local directory ~/.ipfs)
  • 🤓 --soci-index-digest: Specify a particular index digest for SOCI. If left empty, SOCI will automatically use the index determined by the selection policy.

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 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|notation). See ./cosign.md and ./notation.md for details.
  • 🤓 --cosign-key: Path to the private key file, KMS, URI or Kubernetes Secret for --sign=cosign
  • 🤓 --notation-key-name: Signing key name for a key previously added to notation's key list for --sign=notation
  • 🤓 --allow-nondistributable-artifacts: Allow pushing images with non-distributable blobs
  • 🤓 --ipfs-address: Multiaddr of IPFS API (default uses $IPFS_PATH env variable if defined or local directory ~/.ipfs)
  • 🐳 -q, --quiet: Suppress verbose output
  • 🤓 --soci-span-size: Span size in bytes that soci index uses to segment layer data. Default is 4 MiB.
  • 🤓 --soci-min-layer-size: Minimum layer size in bytes to build zTOC for. Smaller layers won't have zTOC and not lazy pulled. Default is 10 MiB.

Unimplemented docker push flags: --all-tags, --disable-content-trust (default true)

🐳 nerdctl load

Load an image from a tar archive or STDIN.

🤓 Supports both Docker Image Spec v1.2 and OCI Image Spec v1.0.

Usage: nerdctl load [OPTIONS]

Flags:

  • 🐳 -i, --input: Read from tar archive file, instead of STDIN
  • 🐳 -q, --quiet: Suppress the load output
  • 🤓 --platform=(amd64|arm64|...): Import content for a specific platform
  • 🤓 --all-platforms: Import content for all platforms

🐳 nerdctl save

Save one or more images to a tar archive (streamed to STDOUT by default)

🤓 The archive implements both Docker Image Spec v1.2 and OCI Image Spec v1.0.

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 .}}
  • 🐳 -H, --human: Print sizes and dates in human readable format (default true)

🐳 nerdctl image prune

Remove unused images.

Usage: nerdctl image prune [OPTIONS]

Flags:

  • 🐳 -a, --all: Remove all unused images, not just dangling ones
  • 🐳 -f, --filter: Filter the images.
    • 🐳 --filter=until=<timestamp>: Images created before given date formatted timestamps or Go duration strings. Currently does not support Unix timestamps.
    • 🐳 --filter=label<key>=<value>: Matches images based on the presence of a label alone or a label and a value
  • 🐳 -f, --force: Do not prompt for confirmation

🤓 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> : read ctr-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 ./stargz.md for 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 ./stargz.md for 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')
  • --zstd : Use zstd compression instead of gzip. Should be used in conjunction with '--oci'
  • --zstd-compression-level=<LEVEL> : zstd compression level (default: 3)
  • --zstdchunked : Use zstd compression instead of gzip (a.k.a zstd:chunked). Should be used in conjunction with '--oci'
  • --zstdchunked-record-in=<FILE> : read ctr-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 ./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:encrypted

⚠️ CAUTION: This command only encrypts image layers, but does NOT encrypt container configuration such as Env 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 ./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:decrypted

Flags:

  • --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

ℹ️ To isolate CNI bridge, CNI plugins v1.1.0 or later needs to be installed.

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
  • 🐳 --ipv6: Enable IPv6. Should be used with a valid subnet.

Unimplemented docker network create flags: --attachable, --aux-address, --config-from, --config-only, --ingress, --internal, --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: --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 both key and value. If value is left empty, matches all volumes with key regardless of its value
    • 🐳 --filter name=<value>: Matches all volumes with a name containing the value string
    • 🤓 --filter "size=<value>": Matches all volumes with a size meets the value. size operand can be >=, <=, >, <, = and value must be an integer. Quotes should be used otherwise some shells may treat operand as redirections

Following arguments for --filter are not supported yet:

  1. --filter=dangling=true: Filter volumes by dangling
  2. --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

Update 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.

⚠️ The output format is not compatible with Docker.

Usage: nerdctl builder prune

Flags:

  • 🤓 --buildkit-host=<BUILDKIT_HOST>: BuildKit address
  • 🐳 --all: Remove all unused build cache, not just dangling ones
  • 🐳 --force: Do not prompt for confirmation

Unimplemented docker builder prune flags: --filter, --keep-storage

🤓 nerdctl builder debug

Interactive debugging of Dockerfile using buildg. Please refer to ./builder-debug.md for details. This is an experimental feature.

⚠️ This command currently doesn't use the host's buildkitd daemon but uses the patched version of BuildKit provided by buildg. This should be fixed in the future.

⚠️ This command is currently incompatible with docker buildx debug.

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

System

🐳 nerdctl events

Get real time events from the server.

⚠️ The output format is not compatible with Docker.

Usage: nerdctl events [OPTIONS]

Flags:

  • 🐳 --format: Format the output using the given Go template, e.g, {{json .}}
  • 🐳 -f, --filter: Filter containers based on given conditions
    • 🐳 --filter event=<value>: Event's status. Start is the only supported status.

Unimplemented docker events flags: --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

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
  • 🤓 --ipfs-address: Multiaddr of IPFS API (default uses $IPFS_PATH env variable if defined or local directory ~/.ipfs)
  • 🐳 `--profile: Specify a profile to enable

🐳 nerdctl compose up

Create and start containers

Usage: nerdctl compose up [OPTIONS] [SERVICE...]

Flags:

  • 🐳 --abort-on-container-exit: Stops all containers if any container was stopped. Incompatible with -d.
  • 🐳 -d, --detach: Detached mode: Run containers in the background. Incompatible with --abort-on-container-exit.
  • 🐳 --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 ipfs.md for details.
  • 🐳 --quiet-pull: Pull without printing progress information
  • 🐳 --scale: Scale SERVICE to NUM instances. Overrides the scale setting 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 ipfs.md for 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
  • 🐳 -T, --no-TTY: Disable pseudo-TTY allocation. By default nerdctl compose exec allocates a TTY.
  • 🐳 -u, --user: Username or UID (format: <name|uid>[:<group|gid>])
  • 🐳 -w, --workdir: Working directory inside the container

🐳 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...]

  • 🐳 -a, --all: Show all containers (default shows just running)
  • 🐳 -q, --quiet: Only display container IDs
  • 🐳 --format: Format the output
    • 🐳 --format=table (default): Table
    • 🐳 --format=json': JSON
  • 🐳 -f, --filter: Filter containers based on given conditions
    • 🐳 --filter status=<value>: One of created, running, paused, restarting, exited, pausing, unknown. Note that removing, dead are not supported and will be ignored
  • 🐳 --services: Print the service names, one per line
  • 🐳 --status: Filter containers by status. Values: [paused | restarting | running | created | exited | pausing | unknown]

🐳 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 cp

Copy files/folders between a service container and the local filesystem

Usage:

nerdctl compose cp [OPTIONS] SERVICE:SRC_PATH DEST_PATH|-
nerdctl compose cp [OPTIONS] SRC_PATH|- SERVICE:DEST_PATH [flags]

Flags:

  • 🐳 --dry-run: Execute command in dry run mode
  • 🐳 -L, --follow-link: Always follow symbol link in SRC_PATH
  • 🐳 --index int: index of the container if service has multiple replicas

Unimplemented docker compose cp flags: --archive

🐳 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 -f in nerdctl rm which 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 ipfs.md for details.

Usage: nerdctl ipfs registry serve [OPTIONS]

Flags:

  • 🤓 --ipfs-address: Multiaddr of IPFS API (default is pulled from $IPFS_PATH/api file. If $IPFS_PATH env var is not present, it defaults to ~/.ipfs).
  • 🤓 --listen-registry: Address to listen (default localhost: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
  • 🤓 --host-gateway-ip: IP address that the special 'host-gateway' string in --add-host resolves to. It has no effect without setting --add-host
    • Default: the IP address of the host

The global flags can be also specified in /etc/nerdctl/nerdctl.toml (rootful) and ~/.config/nerdctl/nerdctl.toml (rootless). See ./config.md.

Unimplemented Docker commands

Container management:

  • docker diff
  • docker checkpoint *

Image:

  • docker export and docker import
  • docker trust * (Instead, nerdctl supports nerdctl pull --verify=cosign|notation and nerdctl push --sign=cosign|notation. See ./cosign.md and ./notation.md.)
  • docker manifest *

Network management:

  • docker network connect
  • docker network disconnect

Registry:

  • docker search

Compose:

  • docker-compose events|scale

Others:

  • docker system df
  • docker 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 *