All Articles

Docker Commands Cheat Sheet 2026 - Essential Reference for DevOps

Published: March 15, 2026 · Updated: April 1, 2026

Docker is the foundation of modern application deployment. Whether you are building microservices, running CI/CD pipelines, or managing production infrastructure, these are the Docker commands you will use every day.

Container Lifecycle

docker run -d --name myapp -p 8080:80 nginx — This single command creates a container from the nginx image, names it "myapp", maps port 8080 on your host to port 80 in the container, and runs it in the background (-d for detached mode).

docker ps shows running containers. Add -a to include stopped ones. Use docker stop to gracefully stop and docker rm to remove.

Image Management

docker build -t myapp:latest . builds an image from a Dockerfile in the current directory. Use docker images to list local images and docker rmi to remove them.

Pro tip: docker system prune -a removes all unused containers, networks, images (both dangling and unreferenced). This can free gigabytes of disk space.

Docker Compose Essentials

Docker Compose V2 uses docker compose (space, not hyphen). The three commands you will use most: docker compose up -d (start services), docker compose down (stop and remove), and docker compose logs -f (follow logs in real time).

Debugging Containers

docker exec -it container_name bash opens a shell inside a running container. Use docker logs container_name to view stdout/stderr. docker stats shows real-time CPU, memory, and network usage for all containers.

Networking and Volumes

docker network ls lists networks. docker volume ls lists persistent volumes. Use docker inspect container_name for complete configuration details including IP addresses and mount points.

Search shortcuts for 230 platforms interactively

Open Shortcut Finder