Docker commands cheatsheet — searchable reference
The everyday Docker commands, grouped so you can find them fast: images, container lifecycle, inspect & debug, volumes & networks, Compose and cleanup. Each command has a short plain-English description and a one-click copy button — handy whether you are learning Docker or just need a quick reminder.
How it works
Commands are organised into six topic sections so related tasks sit together. Type a command name or a task — run, logs, compose, prune — into the search box, and the list filters to matching commands and descriptions as you type. Click Copy next to any command to put it on your clipboard, ready to paste into your terminal. Everything runs locally in your browser; nothing you search or copy is sent anywhere.
Quick example workflow
Looking to run a web server in the background, then check on it:
| Task | Command |
|---|---|
| Run detached, map port 8080→80 | docker run -d -p 8080:80 nginx |
| List running containers | docker ps |
| Follow the logs | docker logs -f <container> |
| Open a shell inside it | docker exec -it <container> sh |
| Stop it | docker stop <container> |
| Reclaim disk space | docker system prune -a |
Search “prune” and you will surface cleanup commands like docker system prune (remove stopped containers, unused networks and dangling images) and docker volume prune (remove unused volumes).
Key commands grouped by task
Working with images
Pull an image from Docker Hub with docker pull <image>:<tag>. Build from a Dockerfile with docker build -t myapp:latest .. List locally cached images with docker images. Remove an image with docker rmi <image>. Tag an image for a registry with docker tag myapp:latest registry/myapp:1.0.
Container lifecycle
Start a one-off interactive container and delete it when you exit: docker run --rm -it ubuntu bash. Run as a named background service: docker run -d --name web -p 8080:80 nginx. Restart a stopped container: docker start <container>. Gracefully stop: docker stop <container>. Force stop: docker kill <container>. Remove stopped containers: docker rm <container>.
Inspecting and debugging
See running processes: docker ps. See all containers (including stopped): docker ps -a. Stream logs: docker logs -f <container>. View recent logs (last 100 lines): docker logs --tail 100 <container>. Open an interactive shell: docker exec -it <container> sh. Inspect all metadata as JSON: docker inspect <container>. See live resource usage: docker stats.
Volumes and networks
Create a named volume: docker volume create mydata. Mount it: docker run -v mydata:/data nginx. List volumes: docker volume ls. Create a bridge network: docker network create mynet. Connect two containers to it so they reach each other by name.
Compose essentials
docker compose up -d builds and starts all services declared in compose.yaml in the background. docker compose down stops and removes containers and networks (volumes survive unless you add -v). docker compose logs -f follows output from all services simultaneously. docker compose ps shows each service’s state.
Cleaning up disk space
Docker images and build cache accumulate quickly. docker system prune removes stopped containers, dangling images, and unused networks. Add -a to also remove every image with no running container — this frees the most space but forces re-pulls next time. docker builder prune targets only build cache without touching images or containers.