320 x 50 Mobile Ad
Cheat Sheets

Docker Cheat Sheet

Transform, format, and optimize your data instantly with this free client-side tool.

Container Management

docker run <image>

Run a command in a new container

docker run -d <image>

Run container in background and print container ID

docker run -p <host_port>:<container_port> <image>

Publish a container's port(s) to the host

docker ps

List running containers

docker ps -a

List all containers (running and stopped)

docker stop <container>

Stop one or more running containers

docker start <container>

Start one or more stopped containers

docker restart <container>

Restart one or more containers

docker rm <container>

Remove one or more containers

docker rm -f <container>

Force remove a running container

docker exec -it <container> sh

Run an interactive shell in a running container

docker logs <container>

Fetch the logs of a container

docker logs -f <container>

Follow log output

docker top <container>

Display the running processes of a container

Image Management

docker images

List locally stored images

docker pull <image>

Pull an image or a repository from a registry

docker push <image>

Push an image or a repository to a registry

docker rmi <image>

Remove one or more images

docker build -t <name:tag> .

Build an image from a Dockerfile in the current directory

docker tag <source> <target>

Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

Network Management

docker network ls

List networks

docker network create <network>

Create a network

docker network rm <network>

Remove one or more networks

docker network connect <network> <container>

Connect a container to a network

docker network disconnect <network> <container>

Disconnect a container from a network

Volume Management

docker volume ls

List volumes

docker volume create <volume>

Create a volume

docker volume rm <volume>

Remove one or more volumes

System & Cleanup

docker info

Display system-wide information

docker system df

Show docker disk usage

docker system prune

Remove unused data (stopped containers, unused networks/images/build cache)

docker system prune -a

Remove all unused images, not just dangling ones

Docker Compose

docker-compose up

Builds, (re)creates, starts, and attaches to containers for a service

docker-compose up -d

Run containers in the background

docker-compose down

Stops containers and removes containers, networks, volumes, and images

docker-compose ps

List containers

docker-compose build

Build or rebuild services

Advanced

docker system prune -a --volumes

DANGEROUS: Remove all unused containers, networks, images, and volumes

docker exec -it <container> /bin/bash

Get an interactive shell inside a running container

docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container>

Get the internal IP address of a container

320 x 50 Mobile Ad

Frequently Asked Questions

Got questions? We've got answers.

The Docker Cheatsheet is a quick-reference guide that provides developers with the most essential and frequently used Docker commands, syntax, and snippets in one centralized place.
This reference is built for both beginners who are just learning Docker and need a quick syntax lookup, as well as seasoned professionals who need to jog their memory on complex commands.
You can use the real-time search bar at the top of the cheatsheet. Simply type a keyword (like &#39;delete&#39; or &#39;file&#39;) and the list will instantly filter to show only matching Docker commands.
Yes! Every command block features a one-click copy button. Just hover over the command and click the copy icon to instantly send the snippet to your clipboard.
The cheatsheet is divided into logical categories such as Basics, Network, Operations, and specific Docker features. You can click on the category filters at the top to isolate specific groups of commands.
Absolutely. This Docker reference guide is 100% free, requiring no sign-ups or subscriptions, and is always available when you need it.
While these are standard Docker operations, you should always understand what a command does before running it, especially if it involves system operations or destructive actions.
Yes, we have recently expanded this cheatsheet to include advanced snippets, best practices, and edge-case syntax that go beyond basic introductory commands.
ADVERTISEMENT
Boost Your Business Online