Skip to content

Instantly share code, notes, and snippets.

@Vicfred
Created October 10, 2025 15:34
Show Gist options
  • Save Vicfred/bfa736496657b99bf0625cf3c791ba3c to your computer and use it in GitHub Desktop.
Save Vicfred/bfa736496657b99bf0625cf3c791ba3c to your computer and use it in GitHub Desktop.
docker cheat sheet

Docker

docker system df # See what's eating space

docker ps
docker ps -a
docker container ls

docker stop <container> # SIGTERM, then SIGKILL after 10s (use -t N to change)
docker kill <container> # immediate SIGKILL

docker system prune # Remove stopped containers, dangling images, unused networks
docker system prune -a --volumes # Same as above plus all images not used by any container and unused volumes (volumes may contain DB/data)

docker image prune # Only dangling
docker image prune -a # All
docker container prune # Stopped containers
docker volume prune # Only dangling volumes


docker images -a # List images
docker rmi $(docker images -q)        # remove all images not in use; add --force as needed

docker volume ls
docker volume ls -qf dangling=true | xargs -r docker volume rm # Remove volumes (data loss if used)

docker network ls
docker network prune

Docker Compose

docker compose up
docker compose ps                 # see running services
docker compose stop               # graceful stop all services in this stack
docker compose down               # stop + remove containers (keeps volumes unless --volumes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment