Show Menu

Docker Cheat Sheet (DRAFT) by

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


docker images
list all images
docker ps
list live containers
docker ps -a
list live and non-live containers
docker push <im­age­>:<­tag>
push image to repo
docker pull <im­age­>:<­tag>
pull image from repo

Container Commands

docker run <im­age>
run container from given image
run in background
-p <ho­st_­p>:­<co­nta­ine­r_p>
expose container port to host
-v <ho­st_­v>:­<co­nta­ine­r_v>
mount host path to container
give the container a name
remove container after exit
docker cp <co­nta­ine­r>:­<pa­th> <h_­pat­h>
copy from container to host
docker cp <h_­pat­h> <co­nta­ine­r>:­<pa­th>
copy from host to container
docker exec -ti <co­nta­ine­r> bash
execute terminal of a live container
docker exec <co­nta­ine­r> <co­mma­nd>
execute a command on a container

docker volume

list volumes
inspect <vo­lum­e>
inspect a specific volume by id or name
rm <vo­lum­e>
remove a specific volume by id or name


run the stack
up <co­nta­ine­r_n­ame>
run a specific service from stack
run in the background
kill all containers
kill <co­nta­ine­r_n­ame>
kill specific container
list running containers of the stack
remove containers
rm -v
remove containers and their volumes
force (re)build of the stack's containers