Docker Cheat Sheet
A searchable, printable Docker reference — images, containers, run options, Dockerfile, volumes, networks, Compose and cleanup. Free.
Images
10docker pull nginx:latest
docker images
docker build -t app:1.0 .
docker tag app:1.0 app:latest
docker rmi app:1.0
docker history app:1.0
docker inspect app:1.0
docker save -o app.tar app:1.0
docker load -i app.tar
docker image prune
Containers
10docker ps
docker ps -a
docker run nginx
docker start web
docker stop web
docker restart web
docker kill web
docker rm web
docker rename web api
docker pause web
Run options
11docker run -d nginx
docker run -it ubuntu bash
docker run --name web nginx
docker run -p 8080:80 nginx
docker run -v data:/var/lib nginx
docker run -e ENV=prod app
docker run --rm alpine echo hi
docker run --network mynet app
docker run --restart unless-stopped app
docker run -w /app node
docker run --memory 512m --cpus 1.5 app
Exec & logs
10docker exec -it web bash
docker exec web ls /app
docker logs web
docker logs -f web
docker top web
docker stats
docker attach web
docker cp web:/app/log.txt .
docker port web
docker inspect web
Build & Dockerfile
14FROM node:20-alpine
WORKDIR /app
COPY . .
ADD app.tar.gz /app
RUN npm install
ENV NODE_ENV=production
ARG VERSION=1.0
EXPOSE 3000
VOLUME /data
USER node
HEALTHCHECK CMD curl -f localhost
CMD ['node', 'app.js']
ENTRYPOINT ['docker-entrypoint.sh']
FROM build AS final
Volumes
10docker volume create data
docker volume ls
docker volume inspect data
docker volume rm data
docker volume prune
docker run -v data:/app nginx
docker run -v $(pwd):/app nginx
docker run -v $(pwd):/app:ro nginx
docker run --mount type=volume,src=data,dst=/app nginx
docker run --tmpfs /tmp nginx
Networks
10docker network create mynet
docker network ls
docker network inspect mynet
docker network connect mynet web
docker network disconnect mynet web
docker network rm mynet
docker network prune
docker network create -d bridge mynet
docker run --network host nginx
docker run --network none alpine
Docker Compose
11docker compose up -d
docker compose down
docker compose ps
docker compose logs -f
docker compose build
docker compose pull
docker compose exec web bash
docker compose restart
docker compose stop
docker compose config
docker compose up --scale web=3
Registry
8docker login
docker login registry.example.com
docker logout
docker tag app user/app:1.0
docker push user/app:1.0
docker pull user/app:1.0
docker search nginx
docker manifest inspect nginx
System & cleanup
10docker info
docker version
docker system df
docker system prune
docker system prune -a
docker container prune
docker image prune
docker volume prune
docker network prune
docker stats --no-stream
No entry matches “:q”.
About Docker Cheat Sheet
This Docker CLI cheat sheet organizes container work by object: images, containers, run options, exec and logs, build and Dockerfile, volumes, networks, Docker Compose, registry commands, and system cleanup. Each row is a complete command with a one-line description.
Docker commands are long and flag-heavy — port mappings, volume mounts, environment variables — and the difference between a working container and a confusing failure is often one flag. The run-options and Compose sections keep those flags visible instead of memorized.
The sheet is free and client-side. Filter commands live with the search box, jump between sections from the sticky table of contents, copy any command with one click and print the page — the cleanup section alone will save you disk space.
How to use Docker Cheat Sheet
- Skim the sections, from Images and Containers through Volumes and Networks to System & cleanup.
- Search for a task like port, mount or prune to filter the commands live.
- Jump to Run options or Docker Compose via the sticky sidebar for flag-heavy commands.
- Click a command or its copy icon to copy it, then adjust image names, ports and paths.
- Print the sheet for a docker reference next to your terminal.