13 docker build [options] .
14 -t "app/container_name" # name
15 --build-arg APP_HOME=$APP_HOME # Set build-time variables
18 Create an `image` from a Dockerfile.
24 docker run [options] IMAGE
25 # see `docker create` for options
31 $ docker run -it debian:buster /bin/bash
33 Run a command in an `image`.
41 docker create [options] IMAGE
42 -a, --attach # attach stdout/err
43 -i, --interactive # attach stdin (interactive)
44 -t, --tty # pseudo-tty
45 --name NAME # name your image
46 -p, --publish 5000:5000 # port map (host:container)
47 --expose 5432 # expose a port to linked containers
48 -P, --publish-all # publish all ports
49 --link container:alias # linking
50 -v, --volume `pwd`:/app # mount (absolute paths needed)
51 -e, --env NAME=hello # env vars
57 $ docker create --name app_redis_1 \
62 Create a `container` from an `image`.
67 docker exec [options] CONTAINER COMMAND
68 -d, --detach # run in background
69 -i, --interactive # stdin
70 -t, --tty # interactive
76 $ docker exec app_web_1 tail logs/development.log
77 $ docker exec -t -i app_web_1 rails c
80 Run commands in a `container`.
86 docker start [options] CONTAINER
87 -a, --attach # attach stdout/err
88 -i, --interactive # attach stdin
90 docker stop [options] CONTAINER
93 Start/stop a `container`.
104 Manage `container`s using ps/kill.
111 $ docker logs $ID 2>&1 | less
112 $ docker logs -f $ID # Follow log output
115 See what's being logged in an `container`.
126 ubuntu 12.10 b750fe78269d
127 me/myapp latest 7b2431a8d968
131 $ docker images -a # also show intermediate
139 docker rmi b750fe78269d
152 Cleans up dangling images, containers, volumes, and networks (ie, not associated with a container)
155 docker system prune -a
158 Additionally remove any stopped containers and all unused images (not just dangling images)
163 # Stop all running containers
164 docker stop $(docker ps -a -q)
166 # Delete stopped containers
167 docker container prune
173 docker image prune [-a]
176 Delete all the images
184 Delete all the volumes
189 * [Getting Started](http://www.docker.io/gettingstarted/) _(docker.io)_