Docker Commands Reference Guide for DevOps Engineers
Introduction
Docker transformed how we build, ship, and run applications. Whether you're spinning up local dev environments, building CI/CD pipelines, or managing production containers, you need the right commands ready.
This guide organizes Docker commands by operational task: managing container lifecycle, building and distributing images, configuring networks and volumes, orchestrating with Compose, and troubleshooting production issues. Each section focuses on practical usage patterns instead of exhaustive flag documentation.
Who this is for: DevOps engineers, developers, SREs, and anyone working with containerized applications.
You'll get: Essential Docker commands for development, CI/CD, and production operations—plus real-world usage patterns and troubleshooting workflows.
Part 1: Container Lifecycle Management
docker run — Create and Start Containers
The most common Docker command. Creates a new container from an image and starts it.
# Basic container run
docker run nginx
# Run in background (detached mode)
docker run -d nginx
# Run with custom name
docker run -d --name my-nginx nginx
# Run with port mapping
docker run -d -p 8080:80 nginx
# Run with environment variables
docker run -d -e DB_HOST=localhost -e DB_PORT=5432 postgres
# Run with volume mount
docker run -d -v /host/path:/container/path nginx
# Run with resource limits
docker run -d --memory="512m" --cpus="1.0" nginx
# Run with restart policy
docker run -d --restart unless-stopped nginx
docker run -d --restart always nginx
docker run -d --restart on-failure:5 nginx
# Run interactively with terminal
docker run -it ubuntu bash
# Run and remove after exit (cleanup)
docker run --rm alpine echo "Hello"
# Run with custom network
docker run -d --network my-network nginx
# Run with multiple options
docker run -d \
--name api-server \
--restart unless-stopped \
-p 3000:3000 \
-e NODE_ENV=production \
-v /data:/app/data \
--memory="1g" \
my-api:latest
Common flags explained:
-d= Detached (run in background)-p host:container= Port mapping-v host:container= Volume mount-e KEY=value= Environment variable--name= Container name (instead of random)--rm= Auto-remove when stopped-it= Interactive terminal--restart= Restart policy
Restart policies:
no= Never restart (default)always= Always restartunless-stopped= Restart unless manually stoppedon-failure:N= Restart on failure, max N times
docker start / stop / restart — Container State Control
# Start stopped container
docker start my-container
# Stop running container (graceful, SIGTERM then SIGKILL after 10s)
docker stop my-container
# Restart container
docker restart my-container
# Start multiple containers
docker start container1 container2 container3
# Stop all running containers
docker stop $(docker ps -q)
# Restart with custom timeout (seconds before SIGKILL)
docker stop -t 30 my-container
docker pause / unpause — Freeze Container Execution
# Pause container (freeze all processes)
docker pause my-container
# Unpause container (resume execution)
docker unpause my-container
# Useful for: resource throttling, taking snapshots, debugging
docker kill — Force Stop Container
# Force stop immediately (SIGKILL)
docker kill my-container
# Send custom signal
docker kill --signal=SIGTERM my-container
docker kill --signal=SIGUSR1 my-container
# Kill all running containers
docker kill $(docker ps -q)
docker rm — Remove Containers
# Remove stopped container
docker rm my-container
# Force remove running container
docker rm -f my-container
# Remove multiple containers
docker rm container1 container2 container3
# Remove all stopped containers
docker rm $(docker ps -a -q -f status=exited)
# Remove with volume
docker rm -v my-container
# Remove all containers (dangerous!)
docker rm -f $(docker ps -a -q)
Part 2: Image Management
docker pull — Download Images
# Pull from Docker Hub
docker pull nginx
docker pull nginx:latest
docker pull nginx:1.25
# Pull from specific registry
docker pull registry.gitlab.com/mygroup/myproject:latest
# Pull all tags
docker pull -a nginx
# Pull with authentication
docker login registry.gitlab.com
docker pull registry.gitlab.com/private/image:tag
docker build — Build Images from Dockerfile
# Build from current directory
docker build .
# Build with tag
docker build -t my-app:latest .
# Build with multiple tags
docker build -t my-app:latest -t my-app:v1.0 .
# Build with build arguments
docker build --build-arg NODE_VERSION=18 -t my-app .
# Build without cache
docker build --no-cache -t my-app .
# Build specific Dockerfile
docker build -f Dockerfile.prod -t my-app:prod .
# Build with target stage (multi-stage)
docker build --target=production -t my-app:prod .
# Build with progress output
docker build --progress=plain -t my-app .
# Build and push
docker build -t registry.gitlab.com/myapp:latest .
docker push registry.gitlab.com/myapp:latest
Example multi-stage Dockerfile:
# Build stage
FROM node:18 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM node:18-alpine AS production
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
CMD ["node", "dist/index.js"]
# Build production stage only
docker build --target=production -t my-app:prod .
docker push — Publish Images
# Login to registry
docker login registry.gitlab.com
# Push to registry
docker push my-app:latest
# Push to GitLab Container Registry
docker push registry.gitlab.com/mygroup/myproject:latest
# Push all tags
docker push -a registry.gitlab.com/mygroup/myproject
docker images — List Images
# List all images
docker images
# List with digests
docker images --digests
# List specific image
docker images nginx
# List with filter
docker images --filter "dangling=true"
# List with custom format
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
# Show image IDs only
docker images -q
docker rmi — Remove Images
# Remove image
docker rmi nginx:latest
# Force remove (even if containers exist)
docker rmi -f nginx:latest
# Remove multiple images
docker rmi image1 image2 image3
# Remove dangling images (untagged)
docker rmi $(docker images -f "dangling=true" -q)
# Remove all images
docker rmi $(docker images -q)
docker tag — Tag Images
# Tag image
docker tag my-app:latest my-app:v1.0
# Tag for registry
docker tag my-app:latest registry.gitlab.com/mygroup/myapp:latest
# Tag for different environments
docker tag my-app:latest my-app:staging
docker tag my-app:latest my-app:production
docker save / load — Export/Import Images
# Save image to tar file
docker save my-app:latest > my-app.tar
docker save -o my-app.tar my-app:latest
# Save multiple images
docker save -o images.tar nginx:latest postgres:15
# Load image from tar
docker load < my-app.tar
docker load -i my-app.tar
# Use case: transfer images between systems without registry
Part 3: Container Operations
docker ps — List Containers
# List running containers
docker ps
# List all containers (including stopped)
docker ps -a
# List with size
docker ps -s
# List with custom format
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
# List only container IDs
docker ps -q
# List with filter
docker ps --filter "status=running"
docker ps --filter "name=api"
docker ps --filter "ancestor=nginx"
# Show last N containers
docker ps -n 5
docker logs — View Container Logs
# View logs
docker logs my-container
# Follow logs (like tail -f)
docker logs -f my-container
# Show timestamps
docker logs -t my-container
# Show last N lines
docker logs --tail 100 my-container
# Show logs since timestamp
docker logs --since 2024-01-01T00:00:00 my-container
# Show logs since duration
docker logs --since 10m my-container
docker logs --since 2h my-container
# Combined: follow with last 50 lines
docker logs -f --tail 50 my-container
# Multiple containers (requires tools)
docker ps -q | xargs -I {} docker logs --tail 10 {}
docker exec — Execute Commands in Running Containers
# Execute command
docker exec my-container ls /app
# Interactive shell
docker exec -it my-container bash
docker exec -it my-container sh # Alpine Linux
# Run as specific user
docker exec -u nginx my-container whoami
# Set working directory
docker exec -w /app my-container pwd
# Set environment variables
docker exec -e DEBUG=true my-container env
# Common use cases:
docker exec -it my-db psql -U postgres
docker exec my-api npm test
docker exec my-container cat /app/config.yml
docker cp — Copy Files To/From Containers
# Copy from container to host
docker cp my-container:/app/logs/error.log ./error.log
# Copy from host to container
docker cp ./config.yml my-container:/app/config.yml
# Copy directory
docker cp my-container:/app/data ./backup-data
# Copy to container directory
docker cp ./dist my-container:/app/
docker inspect — Detailed Container/Image Info
# Inspect container
docker inspect my-container
# Inspect image
docker inspect nginx:latest
# Get specific field (JSON path)
docker inspect --format='{{.State.Status}}' my-container
docker inspect --format='{{.NetworkSettings.IPAddress}}' my-container
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-container
# Get environment variables
docker inspect --format='{{.Config.Env}}' my-container
# Get volumes
docker inspect --format='{{.Mounts}}' my-container
# Pretty print with jq
docker inspect my-container | jq '.[0].NetworkSettings'
docker stats — Resource Usage
# Show live resource usage
docker stats
# Show specific containers
docker stats container1 container2
# No streaming (snapshot)
docker stats --no-stream
# Custom format
docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}"
# Show all containers (including stopped)
docker stats --all
Output columns:
CONTAINER= Container name/IDCPU %= CPU usage percentageMEM USAGE / LIMIT= Memory usage and limitMEM %= Memory percentageNET I/O= Network I/OBLOCK I/O= Disk I/OPIDS= Process count
Part 4: Network Management
docker network ls — List Networks
# List networks
docker network ls
# List with filter
docker network ls --filter "driver=bridge"
# Custom format
docker network ls --format "table {{.Name}}\t{{.Driver}}\t{{.Scope}}"
Default networks:
bridge= Default for standalone containershost= Share host network stacknone= No networking
docker network create — Create Networks
# Create bridge network
docker network create my-network
# Create with subnet
docker network create --subnet=172.18.0.0/16 my-network
# Create with gateway
docker network create --gateway=172.18.0.1 my-network
# Create with driver
docker network create --driver=overlay my-overlay-network
# Create with options
docker network create \
--driver=bridge \
--subnet=172.20.0.0/16 \
--gateway=172.20.0.1 \
--opt="com.docker.network.bridge.name=my-bridge" \
my-custom-network
docker network connect / disconnect — Connect Containers
# Connect container to network
docker network connect my-network my-container
# Connect with IP
docker network connect --ip=172.18.0.10 my-network my-container
# Connect with alias
docker network connect --alias=api my-network my-container
# Disconnect from network
docker network disconnect my-network my-container
# Force disconnect
docker network disconnect -f my-network my-container
docker network inspect — Network Details
# Inspect network
docker network inspect my-network
# Get containers on network
docker network inspect --format='{{range .Containers}}{{.Name}} {{end}}' my-network
# Get subnet
docker network inspect --format='{{range .IPAM.Config}}{{.Subnet}}{{end}}' my-network
docker port — Port Mappings
# Show all port mappings
docker port my-container
# Show specific port
docker port my-container 80
# Output: 0.0.0.0:8080 -> 80/tcp
Part 5: Volume Management
docker volume ls — List Volumes
# List all volumes
docker volume ls
# List with filter
docker volume ls --filter "dangling=true"
# Custom format
docker volume ls --format "table {{.Name}}\t{{.Driver}}\t{{.Mountpoint}}"
docker volume create — Create Volumes
# Create volume
docker volume create my-data
# Create with driver
docker volume create --driver local my-data
# Create with options
docker volume create \
--driver local \
--opt type=none \
--opt device=/host/path \
--opt o=bind \
my-bind-volume
docker volume inspect — Volume Details
# Inspect volume
docker volume inspect my-data
# Get mountpoint
docker volume inspect --format='{{.Mountpoint}}' my-data
docker volume rm — Remove Volumes
# Remove volume
docker volume rm my-data
# Remove multiple volumes
docker volume rm vol1 vol2 vol3
# Remove all unused volumes
docker volume prune
# Force prune (no confirmation)
docker volume prune -f
Part 6: Docker Compose
docker-compose up / down — Service Management
# Start services
docker-compose up
# Start in background
docker-compose up -d
# Build before starting
docker-compose up --build
# Force recreate containers
docker-compose up --force-recreate
# Scale services
docker-compose up -d --scale api=3
# Start specific services
docker-compose up -d api db
# Stop and remove containers
docker-compose down
# Stop and remove with volumes
docker-compose down -v
# Stop and remove with images
docker-compose down --rmi all
docker-compose ps — Service Status
# List services
docker-compose ps
# List all (including stopped)
docker-compose ps -a
# Show services only
docker-compose ps --services
docker-compose logs — Service Logs
# View logs
docker-compose logs
# Follow logs
docker-compose logs -f
# Specific service
docker-compose logs -f api
# Last N lines
docker-compose logs --tail=100 api
# Multiple services
docker-compose logs -f api worker
docker-compose exec — Execute in Service
# Execute command
docker-compose exec api npm test
# Interactive shell
docker-compose exec api bash
# As specific user
docker-compose exec -u postgres db psql
docker-compose build — Build Services
# Build all services
docker-compose build
# Build specific service
docker-compose build api
# Build without cache
docker-compose build --no-cache
# Build with parallel
docker-compose build --parallel
Other Useful Compose Commands
# Restart services
docker-compose restart
# Stop services (keep containers)
docker-compose stop
# Start stopped services
docker-compose start
# Pause services
docker-compose pause
# Unpause services
docker-compose unpause
# View config
docker-compose config
# Pull images
docker-compose pull
# Push images
docker-compose push
Part 7: Registry & Repository Operations
Authenticate to Registries
# Docker Hub
docker login
docker login -u username -p password
# GitLab Container Registry
docker login registry.gitlab.com
docker login registry.gitlab.com -u username -p access_token
# Custom registry
docker login my-registry.example.com
# Logout
docker logout registry.gitlab.com
GitLab Container Registry
# Tag for GitLab
docker tag my-app:latest registry.gitlab.com/mygroup/myproject:latest
# Push to GitLab
docker push registry.gitlab.com/mygroup/myproject:latest
# Pull from GitLab
docker pull registry.gitlab.com/mygroup/myproject:latest
# Use in CI/CD (with deploy token)
echo $CI_DEPLOY_PASSWORD | docker login -u $CI_DEPLOY_USER --password-stdin registry.gitlab.com
Private Registry
# Run local registry
docker run -d -p 5000:5000 --restart=always --name registry registry:2
# Tag for local registry
docker tag my-app:latest localhost:5000/my-app:latest
# Push to local registry
docker push localhost:5000/my-app:latest
# Pull from local registry
docker pull localhost:5000/my-app:latest
Part 8: System Management
docker system df — Disk Usage
# Show disk usage
docker system df
# Show detailed info
docker system df -v
# Output shows:
# - Images space
# - Containers space
# - Local volumes space
# - Build cache
docker system prune — Cleanup
# Remove unused data
docker system prune
# Remove all unused (not just dangling)
docker system prune -a
# Include volumes
docker system prune -a --volumes
# Force (no confirmation)
docker system prune -f
# Specific cleanup:
docker container prune # Remove stopped containers
docker image prune # Remove dangling images
docker image prune -a # Remove all unused images
docker volume prune # Remove unused volumes
docker network prune # Remove unused networks
docker version — Version Info
# Show version
docker version
# Client and server versions
docker version --format '{{.Server.Version}}'
docker info — System Info
# Show system info
docker info
# Shows:
# - Container count
# - Images count
# - Storage driver
# - Kernel version
# - OS info
# - CPU/memory
Part 9: Troubleshooting Workflows
Scenario 1: Container Won't Start
# Check container status
docker ps -a --filter "name=my-container"
# View logs
docker logs my-container
# Inspect container
docker inspect my-container
# Check last exit code
docker inspect --format='{{.State.ExitCode}}' my-container
# Try running interactively
docker run -it --entrypoint /bin/sh my-image
# Check resource limits
docker inspect --format='{{.HostConfig.Memory}}' my-container
Scenario 2: Network Connectivity Issues
# Check container IP
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-container
# Check networks
docker network ls
docker network inspect my-network
# Test connectivity from container
docker exec my-container ping google.com
docker exec my-container curl http://api:3000/health
# Check port mappings
docker port my-container
# Check DNS resolution
docker exec my-container cat /etc/resolv.conf
docker exec my-container nslookup api
Scenario 3: Volume Permission Problems
# Check volume permissions
docker exec my-container ls -la /app/data
# Check volume owner
docker exec my-container stat -c '%U:%G' /app/data
# Run as specific user
docker run -u 1000:1000 -v /host/path:/container/path my-image
# Fix permissions from container
docker exec my-container chown -R appuser:appgroup /app/data
# Or from host
sudo chown -R $(id -u):$(id -g) /host/path
Scenario 4: High Resource Usage
# Check resource usage
docker stats --no-stream
# Identify heavy containers
docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemPerc}}" | sort -k 2 -hr
# Check container processes
docker top my-container
# Set resource limits
docker update --memory="512m" --cpus="0.5" my-container
# Or restart with limits
docker stop my-container
docker rm my-container
docker run -d --name my-container --memory="512m" --cpus="0.5" my-image
Scenario 5: Build Failures
# Build with verbose output
docker build --progress=plain -t my-app .
# Build without cache
docker build --no-cache -t my-app .
# Check build context size
du -sh .
# Use .dockerignore to exclude files
cat > .dockerignore << EOF
node_modules
.git
*.log
.env
EOF
# Debug specific stage
docker build --target=builder -t debug .
docker run -it debug sh
Part 10: Real-World Scenarios
Development Workflow
# Start dev environment
docker-compose up -d
# Watch logs
docker-compose logs -f api
# Make code changes (with volume mount)
# Container automatically reloads
# Run tests
docker-compose exec api npm test
# Check database
docker-compose exec db psql -U postgres
# Restart service
docker-compose restart api
# Stop environment
docker-compose down
CI/CD Pipeline
# Build image
docker build -t my-app:${CI_COMMIT_SHA} .
# Tag for registry
docker tag my-app:${CI_COMMIT_SHA} registry.gitlab.com/mygroup/myapp:latest
# Login to registry
echo ${CI_REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
# Push image
docker push registry.gitlab.com/mygroup/myapp:latest
# Run tests in container
docker run --rm my-app:${CI_COMMIT_SHA} npm test
Production Deployment
# Pull latest image
docker pull registry.gitlab.com/mygroup/myapp:latest
# Stop old container
docker stop myapp || true
docker rm myapp || true
# Start new container
docker run -d \
--name myapp \
--restart unless-stopped \
-p 3000:3000 \
-e NODE_ENV=production \
-v /data/app:/app/data \
--memory="2g" \
--cpus="2.0" \
--log-driver=json-file \
--log-opt max-size=10m \
--log-opt max-file=3 \
registry.gitlab.com/mygroup/myapp:latest
# Health check
sleep 5
curl -f http://localhost:3000/health || exit 1
# Check logs
docker logs myapp
Multi-Stage Build Optimization
# Development stage
FROM node:18 AS development
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "run", "dev"]
# Build stage
FROM node:18 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Production stage
FROM node:18-alpine AS production
WORKDIR /app
RUN apk add --no-cache tini
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY package.json ./
USER node
EXPOSE 3000
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "dist/index.js"]
# Build for development
docker build --target=development -t my-app:dev .
# Build for production
docker build --target=production -t my-app:prod .
Health Checks
FROM nginx:alpine
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1
COPY nginx.conf /etc/nginx/nginx.conf
# Check health status
docker inspect --format='{{.State.Health.Status}}' my-container
# View health check logs
docker inspect --format='{{range .State.Health.Log}}{{.Output}}{{end}}' my-container
Part 11: Best Practices & Pro Tips
Security Best Practices
# Run as non-root user
USER node
# Use specific image versions (not latest)
FROM node:18.17.0-alpine
# Scan images for vulnerabilities
docker scan my-app:latest
# Use read-only root filesystem
docker run --read-only -v /tmp --tmpfs /run my-app
# Drop capabilities
docker run --cap-drop=ALL --cap-add=NET_BIND_SERVICE my-app
# Use secrets for sensitive data
docker secret create db_password ./password.txt
docker service create --secret db_password my-service
Image Optimization
# Use Alpine for smaller images
FROM node:18-alpine
# Multi-stage builds
FROM builder AS build
# ... build steps
FROM alpine AS production
COPY --from=build /app/dist ./
# Combine RUN commands
RUN apk add --no-cache curl && \
curl -o file.tar.gz https://example.com/file.tar.gz && \
tar -xzf file.tar.gz && \
rm file.tar.gz
# Order layers by change frequency
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Use .dockerignore
# Exclude: node_modules, .git, *.log, .env
Resource Management
# Set memory limits
docker run --memory="512m" --memory-swap="1g" my-app
# Set CPU limits
docker run --cpus="1.5" my-app
# Set CPU shares (relative weight)
docker run --cpu-shares=512 my-app
# Set I/O limits
docker run --device-read-bps /dev/sda:1mb my-app
# Set PID limit
docker run --pids-limit=100 my-app
Logging Strategies
# Use JSON file driver with rotation
docker run \
--log-driver=json-file \
--log-opt max-size=10m \
--log-opt max-file=3 \
my-app
# Use syslog
docker run --log-driver=syslog --log-opt syslog-address=udp://192.168.1.1:514 my-app
# Disable logging (performance)
docker run --log-driver=none my-app
# Forward to centralized logging
docker run --log-driver=fluentd --log-opt fluentd-address=localhost:24224 my-app
Backup and Recovery
# Backup container
docker commit my-container my-backup:$(date +%Y%m%d)
# Export container filesystem
docker export my-container > container-backup.tar
# Backup volume
docker run --rm -v my-volume:/data -v $(pwd):/backup alpine tar czf /backup/volume-backup.tar.gz /data
# Restore volume
docker run --rm -v my-volume:/data -v $(pwd):/backup alpine tar xzf /backup/volume-backup.tar.gz -C /
# Backup image
docker save my-app:latest | gzip > my-app-latest.tar.gz
# Restore image
gunzip -c my-app-latest.tar.gz | docker load
Common Aliases
# Add to ~/.bashrc or ~/.zshrc
# Container management
alias dps='docker ps'
alias dpsa='docker ps -a'
alias dlog='docker logs -f'
alias dexec='docker exec -it'
alias dstop='docker stop'
alias drm='docker rm'
# Image management
alias dimgs='docker images'
alias drmi='docker rmi'
alias dbuild='docker build'
alias dpull='docker pull'
alias dpush='docker push'
# System cleanup
alias dprune='docker system prune -a -f'
alias dclean='docker system prune -a --volumes -f'
# Docker Compose
alias dc='docker-compose'
alias dcup='docker-compose up -d'
alias dcdown='docker-compose down'
alias dclog='docker-compose logs -f'
alias dcexec='docker-compose exec'
# Quick access
alias dsh='docker exec -it $(docker ps --format "{{.Names}}" | head -1) sh'
alias dbash='docker exec -it $(docker ps --format "{{.Names}}" | head -1) bash'
Useful One-Liners
# Stop all containers
docker stop $(docker ps -q)
# Remove all containers
docker rm $(docker ps -a -q)
# Remove all images
docker rmi $(docker images -q)
# Remove dangling images
docker rmi $(docker images -f "dangling=true" -q)
# Remove exited containers
docker rm $(docker ps -a -f status=exited -q)
# Get container IP
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name
# Follow logs of latest container
docker logs -f $(docker ps -l -q)
# Run command in all running containers
docker ps -q | xargs -I {} docker exec {} command
# Container resource usage sorted by memory
docker stats --no-stream --format "table {{.Container}}\t{{.MemPerc}}" | sort -k 2 -hr
# Find containers by image
docker ps --filter ancestor=nginx
# Copy file from all containers
docker ps -q | xargs -I {} docker cp {}:/app/log.txt ./logs/{}.txt
Conclusion
Docker commands form the foundation of modern container operations. This guide covered:
Core operations:
- Container lifecycle: run, start, stop, rm
- Image management: build, push, pull, tag
- Operations: logs, exec, cp, stats, inspect
Advanced topics:
- Networking: custom networks, connectivity
- Volumes: data persistence, backups
- Docker Compose: multi-container apps
- Registry operations: publishing, distribution
Production skills:
- Troubleshooting workflows
- Resource management
- Security hardening
- Optimization techniques
Next steps:
- Bookmark this guide for quick reference
- Practice commands in development environment
- Set up aliases for frequent operations
- Build Docker images for your projects
- Create docker-compose.yml for multi-container apps
What's next:
- Kubernetes Commands Reference Guide (coming soon)
- Docker Security Best Practices
- Advanced Multi-Stage Builds
- Docker in CI/CD Pipelines
Take action:
- What Docker patterns do you use? Share in comments
- Have a useful Docker tip? Drop it below
- Subscribe for more DevOps tutorials
- Follow for updates on container orchestration series
Related guides:
Keywords: docker commands, docker cheat sheet, container management, docker reference, docker tutorial, devops containers, docker operations, docker best practices