This is a draft cheat sheet. It is a work in progress and is not finished yet.
General
docker images |
list all images |
docker ps |
list live containers |
docker ps -a |
list live and non-live containers |
docker push <image>:<tag> |
push image to repo |
docker pull <image>:<tag> |
pull image from repo |
Container Commands
docker run <image> |
run container from given image |
-d |
run in background |
-p <host_p>:<container_p> |
expose container port to host |
-v <host_v>:<container_v> |
mount host path to container |
--name |
give the container a name |
--rm |
remove container after exit |
docker cp <container>:<path> <h_path> |
copy from container to host |
docker cp <h_path> <container>:<path> |
copy from host to container |
docker exec -ti <container> bash |
execute terminal of a live container |
docker exec <container> <command> |
execute a command on a container |
docker volume
ls |
list volumes |
inspect <volume> |
inspect a specific volume by id or name |
rm <volume> |
remove a specific volume by id or name |
|
|
docker-compose
up |
run the stack |
up <container_name> |
run a specific service from stack |
-d |
run in the background |
kill |
kill all containers |
kill <container_name> |
kill specific container |
ps |
list running containers of the stack |
rm |
remove containers |
rm -v |
remove containers and their volumes |
build |
force (re)build of the stack's containers |
|
|
|