docker-workflow
БесплатноЗапускает вложенные скриптыНе проверенComprehensive Docker containerization workflow covering multi-stage builds, docker-compose orchestration, image optimization, debugging, and production best…
Об этом скилле
Docker Workflow
Overview
Docker containerization streamlines development, testing, and deployment by packaging applications with their dependencies into portable, reproducible containers. This skill guides you through professional Docker workflows from development to production.
Core Capabilities
- Multi-stage builds: Separate build and runtime dependencies for optimal image size
- Docker Compose orchestration: Manage multi-container applications with networking and dependencies
- Image optimization: Reduce image size by 50-90% through best practices
- Development workflows: Hot-reload, volume mounting, and environment-specific configs
- Debugging tools: Container inspection, health checks, and troubleshooting utilities
- Production readiness: Security hardening, health checks, and deployment strategies
When to Use This Skill
Activate when:
- Containerizing a new application
- Setting up development environments with Docker
- Creating production-ready Docker images
- Orchestrating multi-container applications
- Debugging container issues
- Optimizing Docker builds and images
Workflow Phases
Phase 1: Initial Setup
Create .dockerignore
Exclude unnecessary files from build context:
node_modules/
__pycache__/
*.pyc
.git/
.env
*.log
dist/
build/
coverage/
See examples/.dockerignore for comprehensive template.
Key principles:
- Exclude build artifacts and dependencies
- Exclude sensitive files (.env, credentials)
- Exclude version control (.git)
- Smaller context = faster builds
Analyze Application Requirements
Determine:
- Runtime (Node.js, Python, Go, Java)
- Dependencies and package managers
- Build vs. runtime requirements
- Port exposure and volume needs
Phase 2: Multi-Stage Dockerfile
Choose Strategy
Multi-stage builds reduce final image size by 50-90%:
# Stage 1: Build
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Stage 2: Production
FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
CMD ["node", "dist/index.js"]
See examples/Dockerfile.multi-stage for templates for Node.js, Python, Go, Java, and Rust.
Optimize Layer Caching
Order matters - place changing content last:
# ✅ GOOD: Dependencies cached separately
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
# ❌ BAD: Any file change invalidates cache
COPY . .
RUN npm ci
Apply Security Best Practices
# Use specific versions
FROM node:18.17.1-alpine
# Run as non-root user
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
USER nodejs
# Copy with ownership
COPY --chown=nodejs:nodejs . .
Security checklist:
- Pin base image versions
- Use minimal base images (alpine, slim)
- Run as non-root user
- Scan for vulnerabilities
- Minimize installed packages
Phase 3: Docker Compose Setup
Define Services
Create docker-compose.yml:
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgresql://db:5432/myapp
depends_on:
db:
condition: service_healthy
volumes:
- ./src:/app/src # Development hot-reload
networks:
- app-network
db:
image: postgres:15-alpine
environment:
POSTGRES_DB: myapp
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U user"]
interval: 5s
networks:
- app-network
volumes:
postgres-data:
networks:
app-network:
See examples/docker-compose.yml for full-featured setup with monitoring, queues, and caching.
Environment Configuration
Use override files for different environments:
Development (docker-compose.override.yml):
services:
app:
build:
target: development
volumes:
- ./src:/app/src
environment:
- NODE_ENV=development
command: npm run dev
Production (docker-compose.prod.yml):
services:
app:
build:
target: production
restart: always
environment:
- NODE_ENV=production
Usage:
# Development (uses override automatically)
docker-compose up
# Production
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
Phase 4: Build and Run
Build Commands
# Basic build
docker build -t myapp:latest .
# Build specific stage
docker build --target production -t myapp:prod .
# Build with BuildKit (faster)
DOCKER_BUILDKIT=1 docker build -t myapp:latest .
Run Commands
# Single container
docker run -d -p 3000:3000 -e NODE_ENV=production myapp:latest
# Docker Compose
docker-compose up -d
# View logs
docker-compose logs -f app
# Execute in container
docker-compose exec
Установить docker-workflow в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл docker-workflow?
Comprehensive Docker containerization workflow covering multi-stage builds, docker-compose orchestration, image optimization, debugging, and production best practices. Use when containerizing applications, setting up development environments, or deploying with Docker.
Как установить скилл docker-workflow?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл docker-workflow запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub