Docker

Enjoy this cheat sheet at its fullest within Dash, the macOS documentation browser.

attach

Attach to a running container

--detach-keys

Override the key sequence for detaching a container

--help

Print usage

--no-stdin

Do not attach STDIN

--sig-proxy

Proxy all received signals to the process (default true)

build

Build an image from a Dockerfile

--build-arg

Set build-time variables (default [])

--cgroup-parent

Optional parent cgroup for the container

--cpu-period

Limit the CPU CFS (Completely Fair Scheduler) period

--cpu-quota

Limit the CPU CFS (Completely Fair Scheduler) quota

-c

int          CPU shares (relative weight)

--cpuset-cpus

CPUs in which to allow execution (0-3, 0,1)

--cpuset-mems

MEMs in which to allow execution (0-3, 0,1)

--disable-content-trust

Skip image verification (default true)

-f

string             Name of the Dockerfile (Default is 'PATH/Dockerfile')

--force-rm

Always remove intermediate containers

--help

Print usage

--isolation

Container isolation technology

--label

Set metadata for an image (default [])

-m

string           Memory limit

--memory-swap

Swap limit equal to memory plus swap: '-1' to enable unlimited swap

--no-cache

Do not use cache when building the image

--pull

Always attempt to pull a newer version of the image

-q

Suppress the build output and print image ID on success

--rm

Remove intermediate containers after a successful build (default true)

--shm-size

Size of /dev/shm, default value is 64MB

-t

value               Name and optionally a tag in the 'name:tag' format (default [])

--ulimit

Ulimit options (default [])

commit

Create a new image from a container's changes

-a

string    Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")

-c

value     Apply Dockerfile instruction to the created image (default [])

--help

Print usage

-m

string   Commit message

-p

Pause container during commit (default true)

cp

Copy files/folders between a container and the local filesystem

-L

Always follow symbol link in SRC_PATH

--help

Print usage

create

Create a new container

--add-host

Add a custom host-to-IP mapping (host:ip) (default [])

-a

value                Attach to STDIN, STDOUT or STDERR (default [])

--blkio-weight

Block IO (relative weight), between 10 and 1000

--blkio-weight-device

Block IO weight (relative device weight) (default [])

--cap-add

Add Linux capabilities (default [])

--cap-drop

Drop Linux capabilities (default [])

--cgroup-parent

Optional parent cgroup for the container

--cidfile

Write the container ID to the file

--cpu-percent

CPU percent (Windows only)

--cpu-period

Limit CPU CFS (Completely Fair Scheduler) period

--cpu-quota

Limit CPU CFS (Completely Fair Scheduler) quota

-c

int              CPU shares (relative weight)

--cpuset-cpus

CPUs in which to allow execution (0-3, 0,1)

--cpuset-mems

MEMs in which to allow execution (0-3, 0,1)

--device

Add a host device to the container (default [])

--device-read-bps

Limit read rate (bytes per second) from a device (default [])

--device-read-iops

Limit read rate (IO per second) from a device (default [])

--device-write-bps

Limit write rate (bytes per second) to a device (default [])

--device-write-iops

Limit write rate (IO per second) to a device (default [])

--disable-content-trust

Skip image verification (default true)

--dns

Set custom DNS servers (default [])

--dns-opt

Set DNS options (default [])

--dns-search

Set custom DNS search domains (default [])

--entrypoint

Overwrite the default ENTRYPOINT of the image

-e

value                   Set environment variables (default [])

--env-file

Read in a file of environment variables (default [])

--expose

Expose a port or a range of ports (default [])

--group-add

Add additional groups to join (default [])

--health-cmd

Command to run to check health

--health-interval

Time between running the check

--health-retries

Consecutive failures needed to report unhealthy

--health-timeout

Maximum time to allow one check to run

--help

Print usage

-h

string             Container host name

-i

Keep STDIN open even if not attached

--io-maxbandwidth

Maximum IO bandwidth limit for the system drive (Windows only)

--io-maxiops

Maximum IOps limit for the system drive (Windows only)

--ip

Container IPv4 address (e.g. 172.30.100.104)

--ip6

Container IPv6 address (e.g. 2001:db8::33)

--ipc

IPC namespace to use

--isolation

Container isolation technology

--kernel-memory

Kernel memory limit

-l

value                 Set meta data on a container (default [])

--label-file

Read in a line delimited file of labels (default [])

--link

Add link to another container (default [])

--log-driver

Logging driver for container

--log-opt

Log driver options (default [])

--mac-address

Container MAC address (e.g. 92:d0:c6:0a:29:33)

-m

string               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)

--name

Assign a name to the container

--net

Connect a container to a network (default "default")

--net-alias

Add network-scoped alias for the container (default [])

--no-healthcheck

Disable any container-specified HEALTHCHECK

--oom-kill-disable

Disable OOM Killer

--oom-score-adj

Tune host's OOM preferences (-1000 to 1000)

--pid

PID namespace to use

--pids-limit

Tune container pids limit (set -1 for unlimited)

--privileged

Give extended privileges to this container

-p

value               Publish a container's port(s) to the host (default [])

-P

Publish all exposed ports to random ports

--read-only

Mount the container's root filesystem as read only

--restart

Restart policy to apply when a container exits (default "no")

--runtime

Runtime to use for this container

--security-opt

Security Options (default [])

--shm-size

Size of /dev/shm, default value is 64MB

--stop-signal

Signal to stop a container, SIGTERM by default (default "SIGTERM")

--storage-opt

Set storage driver options per container (default [])

--sysctl

Sysctl options (default map[])

--tmpfs

Mount a tmpfs directory (default [])

-t

Allocate a pseudo-TTY

--ulimit

Ulimit options (default [])

-u

string                 Username or UID (format: <name|uid>[:<group|gid>])

--userns

User namespace to use

--uts

UTS namespace to use

-v

value                Bind mount a volume (default [])

--volume-driver

Optional volume driver for the container

--volumes-from

Mount volumes from the specified container(s) (default [])

-w

string              Working directory inside the container

deploy

Create and update a stack

-f

string   Path to a bundle (Default: STACK.dsb)

--help

Print usage

diff

Inspect changes on a container's filesystem

--help

Print usage

events

Get real time events from the server

-f

value   Filter output based on conditions provided (default [])

--help

Print usage

--since

Show all events created since timestamp

--until

Stream events until this timestamp

exec

Run a command in a running container

export

Export a container's filesystem as a tar archive

--help

Print usage

-o

string   Write to a file, instead of STDOUT

history

Show the history of an image

--help

Print usage

-H

Print sizes and dates in human readable format (default true)

--no-trunc

Don't truncate output

-q

Only show numeric IDs

images

List images

-a

Show all images (default hides intermediate images)

--digests

Show digests

-f

value    Filter output based on conditions provided (default [])

--format

Pretty-print images using a Go template

--help

Print usage

--no-trunc

Don't truncate output

-q

Only show numeric IDs

import

Import the contents from a tarball to create a filesystem image

-c

value     Apply Dockerfile instruction to the created image (default [])

--help

Print usage

-m

string   Set commit message for imported image

info

Display system-wide information

inspect

Return low-level information on a container, image or task

kill

Kill one or more running container

--help

Print usage

-s

string   Signal to send to the container (default "KILL")

load

Load an image from a tar archive or STDIN

--help

Print usage

-i

string   Read from tar archive file, instead of STDIN

-q

Suppress the load output

login

Log in to a Docker registry.

--help

Print usage

-p

string   Password

-u

string   Username

logout

Log out from a Docker registry.

--help

Print usage

logs

Fetch the logs of a container

--details

Show extra details provided to logs

-f

Follow log output

--help

Print usage

--since

Show logs since timestamp

--tail

Number of lines to show from the end of the logs (default "all")

-t

Show timestamps

network

Manage Docker networks

--help

Print usage

node

Manage Docker Swarm nodes

--help

Print usage

pause

Pause all processes within one or more containers

--help

Print usage

plugin

Manage Docker plugins

--help

Print usage

port

List port mappings or a specific mapping for the container

--help

Print usage

ps

List containers

-n

int            Show n last created containers (includes all states) (default -1)

-a

Show all containers (default shows just running)

-f

value    Filter output based on conditions provided (default [])

--format

Pretty-print containers using a Go template

--help

Print usage

-l

Show the latest created container (includes all states)

--no-trunc

Don't truncate output

-q

Only display numeric IDs

-s

Display total file sizes

pull

Pull an image or a repository from a registry

-a

Download all tagged images in the repository

--disable-content-trust

Skip image verification (default true)

--help

Print usage

push

Push an image or a repository to a registry

--disable-content-trust

Skip image verification (default true)

--help

Print usage

rename

Rename a container

--help

Print usage

restart

Restart a container

--help

Print usage

-t

int   Seconds to wait for stop before killing the container (default 10)

rm

Remove one or more containers

-f

Force the removal of a running container (uses SIGKILL)

--help

Print usage

-l

Remove the specified link

-v

Remove the volumes associated with the container

rmi

Remove one or more images

-f

Force removal of the image

--help

Print usage

--no-prune

Do not delete untagged parents

run

Run a command in a new container

--add-host

Add a custom host-to-IP mapping (host:ip) (default [])

-a

value                Attach to STDIN, STDOUT or STDERR (default [])

--blkio-weight

Block IO (relative weight), between 10 and 1000

--blkio-weight-device

Block IO weight (relative device weight) (default [])

--cap-add

Add Linux capabilities (default [])

--cap-drop

Drop Linux capabilities (default [])

--cgroup-parent

Optional parent cgroup for the container

--cidfile

Write the container ID to the file

--cpu-percent

CPU percent (Windows only)

--cpu-period

Limit CPU CFS (Completely Fair Scheduler) period

--cpu-quota

Limit CPU CFS (Completely Fair Scheduler) quota

-c

int              CPU shares (relative weight)

--cpuset-cpus

CPUs in which to allow execution (0-3, 0,1)

--cpuset-mems

MEMs in which to allow execution (0-3, 0,1)

-d

Run container in background and print container ID

--detach-keys

Override the key sequence for detaching a container

--device

Add a host device to the container (default [])

--device-read-bps

Limit read rate (bytes per second) from a device (default [])

--device-read-iops

Limit read rate (IO per second) from a device (default [])

--device-write-bps

Limit write rate (bytes per second) to a device (default [])

--device-write-iops

Limit write rate (IO per second) to a device (default [])

--disable-content-trust

Skip image verification (default true)

--dns

Set custom DNS servers (default [])

--dns-opt

Set DNS options (default [])

--dns-search

Set custom DNS search domains (default [])

--entrypoint

Overwrite the default ENTRYPOINT of the image

-e

value                   Set environment variables (default [])

--env-file

Read in a file of environment variables (default [])

--expose

Expose a port or a range of ports (default [])

--group-add

Add additional groups to join (default [])

--health-cmd

Command to run to check health

--health-interval

Time between running the check

--health-retries

Consecutive failures needed to report unhealthy

--health-timeout

Maximum time to allow one check to run

--help

Print usage

-h

string             Container host name

-i

Keep STDIN open even if not attached

--io-maxbandwidth

Maximum IO bandwidth limit for the system drive (Windows only)

--io-maxiops

Maximum IOps limit for the system drive (Windows only)

--ip

Container IPv4 address (e.g. 172.30.100.104)

--ip6

Container IPv6 address (e.g. 2001:db8::33)

--ipc

IPC namespace to use

--isolation

Container isolation technology

--kernel-memory

Kernel memory limit

-l

value                 Set meta data on a container (default [])

--label-file

Read in a line delimited file of labels (default [])

--link

Add link to another container (default [])

--log-driver

Logging driver for container

--log-opt

Log driver options (default [])

--mac-address

Container MAC address (e.g. 92:d0:c6:0a:29:33)

-m

string               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)

--name

Assign a name to the container

--net

Connect a container to a network (default "default")

--net-alias

Add network-scoped alias for the container (default [])

--no-healthcheck

Disable any container-specified HEALTHCHECK

--oom-kill-disable

Disable OOM Killer

--oom-score-adj

Tune host's OOM preferences (-1000 to 1000)

--pid

PID namespace to use

--pids-limit

Tune container pids limit (set -1 for unlimited)

--privileged

Give extended privileges to this container

-p

value               Publish a container's port(s) to the host (default [])

-P

Publish all exposed ports to random ports

--read-only

Mount the container's root filesystem as read only

--restart

Restart policy to apply when a container exits (default "no")

--rm

Automatically remove the container when it exits

--runtime

Runtime to use for this container

--security-opt

Security Options (default [])

--shm-size

Size of /dev/shm, default value is 64MB

--sig-proxy

Proxy received signals to the process (default true)

--stop-signal

Signal to stop a container, SIGTERM by default (default "SIGTERM")

--storage-opt

Set storage driver options per container (default [])

--sysctl

Sysctl options (default map[])

--tmpfs

Mount a tmpfs directory (default [])

-t

Allocate a pseudo-TTY

--ulimit

Ulimit options (default [])

-u

string                 Username or UID (format: <name|uid>[:<group|gid>])

--userns

User namespace to use

--uts

UTS namespace to use

-v

value                Bind mount a volume (default [])

--volume-driver

Optional volume driver for the container

--volumes-from

Mount volumes from the specified container(s) (default [])

-w

string              Working directory inside the container

save

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

--help

Print usage

-o

string   Write to a file, instead of STDOUT

search

Search the Docker Hub for images

-f

value   Filter output based on conditions provided (default [])

--help

Print usage

--limit

Max number of search results (default 25)

--no-trunc

Don't truncate output

service

Manage Docker services

--help

Print usage

stack

Manage Docker stacks

--help

Print usage

start

Start one or more stopped containers

-a

Attach STDOUT/STDERR and forward signals

--detach-keys

Override the key sequence for detaching a container

--help

Print usage

-i

Attach container's STDIN

stats

Display a live stream of container(s) resource usage statistics

-a

Show all containers (default shows just running)

--help

Print usage

--no-stream

Disable streaming stats and only pull the first result

stop

Stop one or more running containers

--help

Print usage

-t

int   Seconds to wait for stop before killing it (default 10)

swarm

Manage Docker Swarm

--help

Print usage

tag

Tag an image into a repository

--help

Print usage

top

Display the running processes of a container

--help

Print usage

unpause

Unpause all processes within one or more containers

--help

Print usage

update

Update configuration of one or more containers

version

Show the Docker version information

-f

string   Format the output using the given go template

--help

Print usage

volume

Manage Docker volumes

--help

Print usage

wait

Block until a container stops, then print its exit code

--help

Print usage

Notes