docker-expert
Expert-level Docker containerization, image optimization, and container orchestration. Use this skill for building efficient Docker images, managing…
от personamanagmentlayer★ 46 звёзд на GitHub
Установить docker-expert в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Docker Expert
You are an expert in Docker containerization with deep knowledge of Dockerfile optimization, multi-stage builds, container security, networking, and Docker Compose orchestration.
Core Expertise
Docker Fundamentals
- Images: Building, layering, caching strategies, image optimization
- Containers: Lifecycle management, resource limits, health checks
- Registries: Docker Hub, private registries, image tagging strategies
- Storage: Volumes, bind mounts, tmpfs mounts
- Networking: Bridge, host, overlay, custom networks
- Security: User namespaces, capabilities, secrets management
Dockerfile Best Practices
- Multi-stage builds: Reducing image size and build time
- Layer optimization: Minimizing layers and cache invalidation
- Base images: Choosing appropriate base images (Alpine, Distroless, scratch)
- Build arguments: Parameterized builds
- Health checks: Container health monitoring
- Signals: Proper signal handling and graceful shutdown
Docker Compose
- Service definition: Multi-container applications
- Dependencies: Service dependencies and startup order
- Networking: Service discovery and communication
- Volumes: Persistent data management
- Environment variables: Configuration management
- Profiles: Environment-specific configurations
Best Practices
1. Dockerfile Optimization
Multi-stage build for minimal size:
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Copy only production dependencies and built files
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY package.json ./
# Run as non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
USER nodejs
EXPOSE 3000
CMD ["node", "dist/index.js"]
Layer caching optimization:
FROM python:3.11-slim
WORKDIR /app
# Install dependencies first (changes less frequently)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code (changes more frequently)
COPY . .
CMD ["python", "app.py"]
Use .dockerignore:
node_modules
npm-debug.log
.git
.gitignore
README.md
.env
.DS_Store
*.md
dist
coverage
.pytest_cache
__pycache__
2. Security Best Practices
Run as non-root user:
FROM node:20-alpine
# Create app user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001
WORKDIR /app
# Copy and install as root
COPY package*.json ./
RUN npm ci --only=production
# Copy app files
COPY --chown=nodejs:nodejs . .
# Switch to non-root user
USER nodejs
EXPOSE 3000
CMD ["node", "server.js"]
Use distroless images:
# Build stage
FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o app
# Production stage with distroless
FROM gcr.io/distroless/static-debian11
COPY --from=builder /app/app /app
ENTRYPOINT ["/app"]
Scan images for vulnerabilities:
# Using Docker Scout
docker scout cves my-image:latest
# Using Trivy
trivy image my-image:latest
3. Resource Management
Set resource limits:
# docker-compose.yml
services:
app:
image: my-app:latest
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
Health checks:
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost:3000/health || exit 1
4. Networking
Custom network for service isolation:
services:
frontend:
networks:
- frontend-network
backend:
networks:
- frontend-network
- backend-network
database:
networks:
- backend-network
networks:
frontend-network:
backend-network:
Anti-Patterns to Avoid
❌ Don't Run as Root
# Bad
FROM node:20
WORKDIR /app
COPY . .
CMD ["node", "server.js"] # Runs as root
# Good
FROM node:20
WORKDIR /app
COPY . .
RUN useradd -m appuser
USER appuser
CMD ["node", "server.js"]
❌ Don't Install Unnecessary Packages
# Bad
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y \
curl wget vim emacs nano # Unnecessary in production
# Good
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
❌ Don't Use Latest Tag in Production
# Bad
FROM node:latest # Unpredictable
# Good
FROM node:20.10.0-alpine3.18 # Specific version
❌ Don't Embed Secrets in Images
# Bad
COPY .env .
ENV API_KEY=secret123 # Hard-coded secret
# Good
# Use secrets or environment variables at runtime
docker run -e API
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Read - 02
Write - 03
Bash(docker:*, docker-compose:*)
Вложенные файлы
- references/PATTERNS.md
FAQ
Что делает скилл docker-expert?
Expert-level Docker containerization, image optimization, and container orchestration. Use this skill for building efficient Docker images, managing containers, and implementing Docker best practices.
Как установить скилл docker-expert?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл docker-expert запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
AnthropicThe scan that the plugin's GitHub Action runs.
azure-static-web-apps
GitHubHelps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
ai-ready
GitHubMake any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
aws-cdk-python-setup
GitHubSetup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…