Overview
Docker revolutionized software development by enabling consistent, portable application packaging. This training covers container fundamentals, image building, multi-container applications, and production best practices.
Container Fundamentals
- Containers vs Virtual Machines - Understanding the differences
- Docker Images - Layers, registries, and image management
- Container Lifecycle - Create, start, stop, remove
- Docker CLI - Essential commands for daily operations
Dockerfile Best Practices
- Multi-stage Builds - Optimize image size
- Layer Caching - Speed up build times
- Security Scanning - Vulnerability detection
- Non-root Users - Running containers securely
Sample Dockerfile
# Multi-stage build for Node.js application
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
FROM node:18-alpine
WORKDIR /app
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
COPY --from=builder /app/node_modules ./node_modules
COPY --chown=nodejs:nodejs . .
USER nodejs
EXPOSE 3000
CMD ["node", "server.js"]
Docker Compose
- Multi-container Applications - Service definitions
- Networks - Container communication
- Volumes - Persistent data storage
- Environment Variables - Configuration management
Docker Compose Example
version: '3.8'
services:
web:
build: .
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgres://db:5432/myapp
depends_on:
- db
networks:
- app-network
db:
image: postgres:14-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=myapp
- POSTGRES_PASSWORD=secret
networks:
- app-network
volumes:
postgres_data:
networks:
app-network:
driver: bridge
Networking & Storage
- Bridge Networks - Default container networking
- Host & Overlay Networks - Advanced networking
- Volumes & Bind Mounts - Data persistence
- tmpfs Mounts - In-memory storage
Want this training for your team?
I deliver hands-on sessions tailored to your stack, level and goals.