docker-containers
Docker Containerization
Build and deploy applications with Docker containers, multi-stage builds, and production-ready configurations.
Core Patterns
Dockerfile
# Multi-stage build
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine
WORKDIR /app
COPY /app/dist ./dist
COPY package*.json ./
RUN npm ci --production
EXPOSE 3000
CMD ["node", "dist/index.js"]
Docker Compose
version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgres://user:pass@db:5432/myapp
depends_on:
- db
- redis
db:
image: postgres:16-alpine
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
- POSTGRES_DB=myapp
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
postgres_data:
Build and Run
# Build image
docker build -t myapp:latest .
# Run container
docker run -d -p 3000:3000 --name myapp myapp:latest
# View logs
docker logs -f myapp
# Execute command in container
docker exec -it myapp sh
Best Practices
- Use multi-stage builds
- Minimize layer count
- Use .dockerignore
- Run as non-root user
- Use alpine images
- Implement health checks
- Use Docker secrets
- Tag images properly
Resources
More from spjoshis/claude-code-plugins
excel-analysis
Master Excel for data analysis with pivot tables, formulas, Power Query, and advanced Excel techniques.
50flutter-performance
Optimize Flutter app performance with widget rebuilds, memory management, rendering optimization, and profiling techniques. Achieve smooth 60fps rendering.
10bloc-pattern
Master BLoC (Business Logic Component) pattern for Flutter with flutter_bloc. Learn events, states, testing, and advanced patterns for scalable apps.
9product-backlog-management
Master product backlog management with prioritization frameworks, refinement techniques, estimation, and continuous backlog optimization for maximum value delivery.
6laravel-development
Master Laravel 11 with Eloquent ORM, routing, middleware, queues, testing, and modern PHP development patterns.
6rxjs-patterns
Master RxJS in Angular with observables, operators, subjects, error handling, and reactive patterns for building responsive applications.
5