Tool cheatsheet
Docker 29 Cheatsheet
Build, run and clean up containers and images, and manage multi-container apps with Docker Compose.
Getting started
- Check the Docker version — Print the client and server versions.
- Show system information — Show containers, images, storage driver and other details of the Docker daemon.
- Test your installation — Run a tiny container that prints a message and exits.
- Log in to a registry — Sign in to Docker Hub, or to another registry by passing its address.
Images
- Build an image — Build an image from the Dockerfile in the current directory and tag it.
- List images — Show the images stored locally.
- Pull an image — Download an image from a registry.
- Tag an image — Give an existing image another name, for example before pushing.
- Push an image — Upload an image to a registry.
- Remove an image — Delete a local image. Docker refuses if a container still uses it.
Containers
- Run a container in the background — Start a named container and publish host port 8080 to container port 80.
- Run a throwaway shell with your code mounted — Start a temporary container, mount the current folder and delete the container when you exit.
- List running containers — Show the containers that are currently running.
- List all containers — Include stopped containers.
- Stop a container — Ask a container to stop gracefully.
- Start a stopped container — Start a container that already exists.
- Restart a container — Stop and start a container.
- Remove a container — Delete a stopped container. Add -f to remove a running one.
- Open a shell in a running container — Run an interactive shell inside a container. Use bash if the image has it.
- Follow container logs — Stream the last 100 lines and new output.
- Inspect a container — Show its full configuration and state as JSON.
- Watch resource usage — Live CPU, memory and network use of running containers.
- Copy a file out of a container — Copy a file from a container to the current folder.
Volumes and networks
- Create a volume — Create a named volume for data that should outlive containers.
- List volumes — List the volumes on this Docker host.
- Remove a volume — Delete a volume that no container uses.
- Create a network — Create a user-defined network where containers can reach each other by name.
- List networks — List the networks on this Docker host.
Docker Compose
- Start the services — Build if needed and start everything in compose.yaml in the background.
- Stop and remove the services — Stop and remove the containers and networks. Volumes are kept.
- Stop and remove services and volumes — Also delete the named volumes declared in the file.
- List the services — Show the containers of the project.
- Follow a service's logs — Stream the logs of one service.
- Rebuild the images — Build the images of services that have a build section.
- Open a shell in a service — Run a shell inside a running service container.
- Check the merged config — Validate the file and print it with variables and overrides applied.
Cleaning up
- See how much space Docker uses — Show space used by images, containers, volumes and build cache.
- Remove stopped containers — Delete every stopped container.
- Remove dangling images — Delete untagged images that nothing uses.
- Remove unused data — Delete stopped containers, unused networks, dangling images and build cache.
Related cheatsheets
- Ansible 2 cheatsheet — Run ad-hoc commands and playbooks, manage inventories, roles, collections and secrets with Ansible.
- Argo CD 3 cheatsheet — Install Argo CD, define Applications declaratively, and manage sync, diffs, history and rollbacks with the argocd CLI.
- AWS CLI 2 cheatsheet — Configure credentials and manage S3, EC2, Lambda, logs, containers and secrets with the AWS CLI v2.
- Azure CLI 2 cheatsheet — Sign in and manage resource groups, VMs, web apps, storage, Kubernetes, registries and secrets with the az command.
- Bash and Linux 5 cheatsheet — Everyday shell and Linux commands for files, searching text, permissions, processes and servers.
- Claude API cheatsheet — Call Claude from Python, TypeScript or curl: messages, streaming, thinking, tools, structured output, caching, batches and error handling.