Show Menu
Cheatography

Docker Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Containers

create
creates a container but does not start it.
run
creates and starts a container in one operation.
stop
stops it.
start
will start it again.
restart
restarts a container.
rm
deletes a container.
kill
sends a SIGKILL to a container.
attach
will connect to a running container.
wait
blocks until container stops.

Info

ps
shows running contai­ners.
logs
gets logs from container.
inspect
looks at all the info on a container (including IP address).
events
gets events from container.
port
shows public facing port of container.
top
shows running processes in container.
stats
shows contai­ners' resource usage statis­tics.
diff
shows changed files in the contai­ner's FS.

Import / Export

cp
copies files or folders out of a contai­ner's filesy­stem.
export
turns container filesystem into tarball archive stream to STDOUT.

Executing Commands

exec
to execute a command in container.
 

Images

images
shows all images.
import
creates an image from a tarball.
build
creates image from Docker­file.
commit
creates image from a container.
rmi
removes an image.
insert
inserts a file from URL into image. (kind of odd, you'd think images would be immutable after create)
load
loads an image from a tar archive as STDIN, including images and tags (as of 0.7).
save
saves an image to a tar archive stream to STDOUT with all parent layers, tags & versions (as of 0.7).

Info

history
shows history of image.
tag
tags an image to a name (local or registry).

Registry & Repository

login
to login to a registry.
search
searches registry for image.
pull
pulls an image from registry to local machine.
push
pushes an image to the registry from local machine.

Dockerfile

FROM
<im­age­>:<­tag>
MAINTAINER
<na­me>
RUN
<shell comman­d>
CMD
<co­mma­nd>
EXPOSE
<po­rt>
ENV
<ke­y> <va­lue>
ADD
<sr­c>... <de­st>
COPY
<sr­c>... <de­st>
ENTRYPOINT
command param1 param2
VOLUME
["/d­ata­"]
USER
daemon
WORKDIR
/path/­to/­workdir
ONBUILD
[INSTR­UCTION]