Black Friday: 50% off every workbook with code . Ends Nov 30, 23:59 ET. Buy Now

Last day: 50% off every workbook ends tonight at 23:59 ET. Code Buy Now

Skip to main content
beginner Free with email

Free Docker Commands Cheat Sheet PDF: 70+ Docker Commands Explained

Reviewed 2026-09-21

Direct answer
The core Docker commands are docker run (create and start a container), docker ps (list containers), docker stop and docker rm (stop and remove), docker images (list images), docker pull and docker build (get or build an image), docker exec -it (open a shell) and docker system prune (clean up). This free PDF lists 71 commands and examples in 10 sections.

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.

Docker usage in the Stack Overflow 2025 survey: 71.1% of all developers and 73.8% of professional developers, a 17 point jump
Docker usage rose 17 points in the 2025 Stack Overflow survey, the largest jump of any technology.

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 commands cheat sheet: docker run in three steps, docker pull nginx, docker run -d -p 80:80 nginx, then docker ps to confirm
What a docker run does: pull the image if it’s missing, create and start the container, then check it with docker ps.
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 restart policy compared: always restarts a manually stopped container after a daemon restart, unless-stopped keeps it stopped
Both policies restart a crashed container. They differ only after you stop one by hand.

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

CommandRemoves
docker container pruneStopped containers
docker image pruneDangling images only
docker image prune -aAll images no container uses
docker network pruneUnused networks
docker system pruneStopped containers, unused networks, dangling images, build cache
docker system prune -aThe 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

Bar chart of the Docker commands cheat sheet PDF by section: Container Management has 18 rows, 71 table rows in total
The PDF’s 71 table rows by section. Container Management leads with 18, and 13 rows are image pull examples.
  • 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.

Frequently asked questions

Is this Docker commands cheat sheet PDF really free?
Yes. No credit card, just your email.
What are the basic Docker commands?
docker run starts a container, docker ps lists running ones, docker stop and docker rm stop and remove them, and docker images lists what you've downloaded.
What does the docker run command do?
It pulls the image if it isn't local, creates a container from it, then starts it. Add -d to run it in the background and -p host:container to publish a port.
What is a Docker restart policy?
The rule for whether Docker restarts a container when it stops: no (default), on-failure, always or unless-stopped. After a manual stop, always restarts it when the daemon restarts, while unless-stopped leaves it stopped.
What's the difference between docker image prune and docker system prune?
docker image prune removes dangling images, and -a adds every unused image. docker system prune also removes stopped containers, unused networks and build cache, but not volumes unless you add --volumes.
Does this cover Docker Compose or Dockerfile syntax?
No. See the Docker Compose commands cheat sheet and the Dockerfile commands cheat sheet on SMEnode Labs.

Questions about this PDF

No questions yet. Ask the first one.

Ask a question

Your email address won't be published. We review every question before it appears. How we handle your data. Required fields are marked

Reviewed by

CCDE/CCIE

How to cite this resource

SMEnode Labs (2026). Free Docker Commands Cheat Sheet PDF: 70+ Docker Commands Explained. SMEnode Labs. https://smenode-labs.com/free-pdf/devops/docker-commands-cheat-sheet-pdf/

APA

SMEnode Labs. (2026). Free Docker Commands Cheat Sheet PDF: 70+ Docker Commands Explained. SMEnode Labs. https://smenode-labs.com/free-pdf/devops/docker-commands-cheat-sheet-pdf/

BibTeX

@misc{smenodelabs2026,
  title = {Free Docker Commands Cheat Sheet PDF: 70+ Docker Commands Explained},
  author = {{SMEnode Labs}},
  year = {2026},
  url = {https://smenode-labs.com/free-pdf/devops/docker-commands-cheat-sheet-pdf/},
  note = {SMEnode Labs}
}