The core Docker commands are docker run (create and start a container), docker ps (list containers), docker stop and docker rm (stop and remove one), docker images (list images), docker pull and docker build (get or build an image), docker exec -it (open a shell inside a container), docker logs (read its output) and docker system prune (clean up). This free Docker commands cheat sheet PDF lists 71 commands and examples in 10 sections: install, images, containers, Docker Hub, networking, volumes, files, monitoring and cleanup. It’s free. Drop your email and the PDF lands in your inbox.
Why Learn the Docker Commands Cheat Sheet Basics First
Docker is one of the most-used tools in development. In the Stack Overflow 2025 survey, 71.1% of developers used it, a 17-point jump, the largest of any technology surveyed.

This is a Docker CLI cheat sheet: everything here is a command you type, not a file you write. For Dockerfile syntax see our Dockerfile commands cheat sheet, and for multi-container apps see the Docker Compose commands cheat sheet.
Docker Commands Cheat Sheet: Install and Start the Service
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
sudo dnf install docker-ce docker-ce-cli containerd.io
sudo systemctl enable --now docker # start now and on every boot
docker --version # installed version
docker info # system-wide info
Those are the steps from Docker’s RHEL install guide. Older sheets, including the PDF, show sudo yum install docker -y. That installs your distribution’s own docker package, which Docker’s docs list as unofficial and ask you to remove first. New to systemctl? Our Linux Commands Cheat Sheet covers it.
Docker uses a client-server design. The docker command you type talks to a background daemon (dockerd) that does the work. Default storage is /var/lib/docker/.
Docker Run Command: The Flags That Actually Matter
When you run a container, Docker pulls the image if it’s missing, creates the container, then starts it.

docker run -d -p 8080:80 --name web nginx # background, host:container port, a real name
docker run -d -e NODE_ENV=production myapp # environment variable
docker run -d --restart=unless-stopped nginx # restart policy
docker run -d --memory="256m" --cpus="0.5" myapp # resource limits
docker run -d --health-cmd="curl -f http://localhost/ || exit 1" --health-interval=30s --health-retries=3 myapp
The health command runs inside the container, so the image must contain curl.
Docker Restart Policy: always vs unless-stopped
Docker has four restart policies, per its docs: no (default), on-failure (only after a non-zero exit), always and unless-stopped. Both of the last two restart a container that crashes. They differ after a manual stop. With always, a stopped container comes back when the Docker daemon restarts. With unless-stopped, it stays stopped.

Docker Commands Cheat Sheet: Container Lifecycle and Troubleshooting
docker ps -a # every container, running or stopped
docker start|stop|restart <container_id> # change state
docker rm <container_id> # remove a stopped container
docker rm -f <container_id> # force-remove a running one (kills it)
docker exec -it <container_id> /bin/bash # shell inside a running container
docker logs <container_id> # first place to look
docker inspect <container_id> # full JSON: network, mounts, env vars
docker stats # live CPU, memory and I/O
docker top <container_id> # processes inside one container
docker rm $(docker ps -aq) removes every stopped container and errors on running ones. If a container exits immediately, read docker logs. If it exits before you can, drop -d so the error shows live. On Kubernetes the same first moves are kubectl logs and kubectl exec, listed in our kubectl cheat sheet.
Docker Image Commands: Pull, Build and Tag
docker pull <image_name> # download from Docker Hub
docker images # list local images
docker build -t <image_name> . # build from the Dockerfile here
docker tag <image_id> <username>/<repo>:<tag> # add another name:tag to an image
docker rmi <image_id> # remove an image
Docker Hub, Networking and Volumes Commands
docker login # authenticate to Docker Hub
docker push <username>/<repo>:<tag> # publish an image
docker network create <network_name> # containers on it reach each other by name
docker network connect <network_name> <container> # attach a running container
docker volume create <volume_name> # data that outlives the container
docker run -d -v <volume_name>:/usr/share/nginx/html nginx
Popular pulls: nginx and httpd (web servers), mysql, postgres, mongo and redis (data), node and python (runtimes), alpine (smallest base image).
Docker Cleanup Commands: What Each Prune Removes
| Command | Removes |
|---|---|
docker container prune | Stopped containers |
docker image prune | Dangling images only |
docker image prune -a | All images no container uses |
docker network prune | Unused networks |
docker system prune | Stopped containers, unused networks, dangling images, build cache |
docker system prune -a | The above, plus all unused images |
Volumes aren’t removed unless you add --volumes, per Docker’s prune docs. So docker image prune, as the PDF labels it, doesn’t remove “all unused images” without -a.
What’s Inside the Docker Commands Cheat Sheet PDF

- 71 table rows across 10 sections, 13 of them image pull examples
- Every command paired with a plain-English purpose
- A table of the most-pulled Docker Hub images
- Print-ready, built to sit next to your keyboard
The PDF doesn’t cover restart policies, resource limits or health checks. Those are on this page.
Who It’s For
- Anyone learning Docker, no experience assumed
- DevOps career switchers studying containers alongside Kubernetes, CI/CD and Terraform
- Developers and sysadmins who want a fast syntax check
- Anyone prepping for an interview. Our Free DevOps Interview Questions PDF has a Docker section that pairs with these commands.
A cheat sheet tells you what a flag does. It won’t put you in front of a crash-looping container with only the logs for help.
No questions yet. Ask the first one.