Skip to main content
📬 Get weekly Production AI insights Practical notes on Kubernetes, AI infrastructure and platform engineering. No spam. Subscribe free
Docker Cheat Sheet: Essential Commands for 2026
DevOps

Docker Cheat Sheet: Essential Commands for 2026

Docker cheat sheet with 60+ essential commands. Build, run, network, volume, compose, and troubleshooting commands — organized by workflow for daily use.

LB
Luca Berton
· 1 min read

A quick reference for Docker — the container platform. Bookmark this page.

Container Lifecycle

# Run
docker run -d --name web -p 8080:80 nginx:alpine
docker run -it --rm ubuntu:22.04 bash
docker run -d -v ./data:/data --env-file .env myapp:v1

# List
docker ps                    # Running
docker ps -a                 # All

# Stop/start/restart
docker stop web
docker start web
docker restart web

# Remove
docker rm web
docker rm -f web
docker container prune       # Remove all stopped

Images

# Build
docker build -t myapp:v1 .
docker build -t myapp:v1 -f Dockerfile.prod .
docker build --no-cache -t myapp:v1 .
docker build --platform linux/amd64,linux/arm64 -t myapp:v1 .

# List and manage
docker images
docker image prune           # Remove dangling
docker image prune -a        # Remove all unused
docker rmi nginx:alpine

# Pull/push
docker pull nginx:alpine
docker tag myapp:v1 registry.example.com/myapp:v1
docker push registry.example.com/myapp:v1

Inspect and Debug

# Logs
docker logs web
docker logs -f web           # Follow
docker logs --tail 100 web

# Execute in container
docker exec -it web bash
docker exec web cat /etc/nginx/nginx.conf

# Inspect
docker inspect web
docker inspect --format '{{.NetworkSettings.IPAddress}}' web

# Resource usage
docker stats
docker top web

Volumes and Networks

# Volumes
docker volume create mydata
docker volume ls
docker run -v mydata:/data nginx
docker volume rm mydata

# Networks
docker network create mynet
docker network ls
docker run --network mynet --name web nginx
docker network connect mynet existing-container

Docker Compose

docker compose up -d
docker compose down
docker compose logs -f
docker compose ps
docker compose exec web bash
docker compose build --no-cache

Cleanup

# Remove everything unused
docker system prune -a --volumes

# Check disk usage
docker system df

Tips and Tricks

  • Use multi-stage builds to reduce image size
  • Use .dockerignore to exclude files from build context
  • Use --init flag for proper signal handling in containers
  • Pin image versions: nginx:1.25-alpine not nginx:latest
  • Use docker compose watch for live development reloading
#Comparison #DevOps #DevOps #2026
Share:

Want to operate this yourself, in production?

Take the free AI Platform Engineer Readiness Scorecard to see which skills transfer — then build a production-shaped AI platform in the 4-week Bootcamp.

Take the Scorecard →
Luca Berton — The Production AI Expert, Docker Captain

Luca Berton

The Production AI Expert · Docker Captain · KubeCon Speaker

15+ years in enterprise infrastructure. Author of 8 technical books, creator of Ansible Pilot (1M+ YouTube views, 648K site users). Former Red Hat engineer. Speaker at KubeCon EU 2026 and Red Hat Summit 2026.

Free 30-min Production AI consultation

Book Now