Asosiy/Cheat Sheets/Docker & Docker Compose CLI Cheat Sheet
devops

Docker & Docker Compose CLI Cheat Sheet

A focused cheatsheet of Docker and Compose CLI commands for daily engineering and cloud operations.

Images & Containers

docker ps -a

List all running and stopped containers

docker build -t app-name:v1 .

Build image from Dockerfile in current directory

docker run -d -p 3000:3000 --name web app-name:v1

Run detached container with port 3000 exposed

docker logs -f --tail 100 <container_id>

Stream real-time stdout logs with 100 lines tail

System Prune & Cleanup

docker system prune -af --volumes

Nuclear prune: reclaim disk by removing all dangling containers, networks, and volumes

docker stats

Live real-time stream of CPU and memory utilization per container

Docker Compose Workflows

docker compose up -d --build

Rebuild and start all stack services in background

docker compose down -v

Tear down stack containers and associated persistent volumes

Amaliy Maslahatlar va Xavfsizlik
Use multi-stage builds and Alpine or Distroless base images
Always define .dockerignore to exclude node_modules and version control directories

Boshqa Cheat Sheetlar