Docker Quick Reference
Docker commands for images, containers, volumes, networks and Compose, plus a Dockerfile template.
5 sections · 31 snippets · updated Oct 14, 2026
Click any snippet to copy it.
Images
Build and manage images.
TaskCode
- Build an image
- List images
- Pull / push
- Tag an image
- Remove an image
- Remove unused images
Containers
Run and manage containers.
TaskCode
- Run a container
- Run interactively and remove on exit
- Pass environment variables
- Mount a folder
- List containers
- Stop / start / restart
- Shell into a container
- View logs
- Remove a container
- Copy files
- Resource usage
Volumes & networks
Persistent data and connectivity.
TaskCode
- Create / list volumes
- Use a named volume
- Create a network
- Run on a network
- Clean up everything unused
Compose
Multi-container apps.
TaskCode
- Start in the background
- Rebuild and start
- Stop and remove
- Logs
- Run a command in a service
- compose.yaml example
Dockerfile
Describe how to build an image.
TaskCode
- Node.js app
- Multi-stage build
- Ignore files