Docker/Docker compose cheatsheet

My most often forgotten docker commands

docker

Published 4 years ago

A list of Docker commands I can refer to for future use.

Docker

Show docker containers (including ids)

docker ps

Show docker volumes

docker volume ls

Remove all unused local volumes. Unused local volumes are those which are not referenced by any containers.

docker volume prune

Remove specific volume

docker volume rm <volume_name>

Enter docker container

docker exec -it <container name>

Docker Compose

docker-compose up -d

-d is detached mode, for running containers without needing to retain shell window open.

Building a docker image

docker-compose build service_name