Docker#
Images#
Command |
Action |
|---|---|
|
list local images |
|
pull from registry |
|
push |
|
remove image |
|
tag |
|
build from Dockerfile |
|
|
|
|
|
layer history |
|
remove dangling |
|
nuke unused (careful) |
Containers#
Command |
Action |
|---|---|
|
running containers |
|
all |
|
interactive |
|
detached, port-mapped |
|
volume mount |
|
env var |
|
named, network |
|
|
|
|
|
follow logs |
|
|
|
JSON details |
|
live stats |
|
copy out |
|
Compose#
Command |
Action |
|---|---|
|
start (foreground) |
|
start detached |
|
stop + remove |
|
also remove volumes |
|
follow logs |
|
services status |
|
|
|
rebuild |
|
pull latest images |
|
one-off command |
|
validate / merge config |
Networks and Volumes#
Command |
Action |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cleanup Recipes#
$ docker stop $(docker ps -q)
$ docker container prune -f
$ docker image prune -af
$ docker volume prune -f
$ docker system prune -af --volumes
Useful Flags#
Flag |
Effect |
|---|---|
|
interactive + tty |
|
auto-remove on exit |
|
detached |
|
publish host:container |
|
bind mount |
|
explicit mount syntax |
|
environment variable |
|
env from file |
|
explicit name |
|
custom network |
|
|
|
add Linux capability |
|
drop all (then add what’s needed) |
|
read-only filesystem |
|
run as user |
|
inject |