docker
БесплатноБез исполняемых скриптовНе проверенDocker containerization. Covers Dockerfile, images, and best practices. Use for containerizing applications. USE WHEN: user mentions "dockerfile", "docker…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Docker Core Knowledge
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:dockerfor comprehensive documentation.
Dockerfile (Node.js)
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY package*.json ./
USER node
EXPOSE 3000
CMD ["node", "dist/index.js"]
Dockerfile (Python)
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
USER nobody
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
Common Commands
# Build
docker build -t myapp:latest .
docker build -f Dockerfile.prod -t myapp:prod .
# Run
docker run -d -p 3000:3000 --name myapp myapp:latest
docker run --env-file .env myapp:latest
# Manage
docker ps # List running
docker logs myapp # View logs
docker exec -it myapp sh # Shell access
docker stop myapp # Stop container
docker rm myapp # Remove container
# Images
docker images # List images
docker rmi myapp:latest # Remove image
docker system prune # Clean up
Best Practices
| Do | Don't |
|---|---|
| Multi-stage builds | Run as root |
| Use .dockerignore | Copy node_modules |
| Specific base image tags | Use latest in prod |
| One process per container | Install unnecessary packages |
| Layer caching (COPY package.json first) | Hardcode secrets |
.dockerignore
node_modules
.git
.env*
dist
*.log
When NOT to Use This Skill
Skip this skill when:
- Managing multi-container applications with docker-compose.yml - use
docker-composeskill - Orchestrating containers in Kubernetes - use
kubernetesskill - CI/CD pipeline automation - use
github-actionsskill - Only running third-party images without creating Dockerfiles
- Using container platforms that abstract Docker (e.g., Heroku, Google Cloud Run config)
Anti-Patterns
| Anti-Pattern | Problem | Solution |
|---|---|---|
Using :latest in production |
Unpredictable deployments | Pin specific versions node:20.10.0-alpine |
| Running as root | Security vulnerability | Use USER node or create non-root user |
Copying node_modules/ |
Slow builds, platform issues | Add to .dockerignore, run npm ci in container |
| Installing dev dependencies | Bloated images | Use npm ci --only=production |
| No multi-stage builds | Large production images | Separate build and runtime stages |
| Hardcoding secrets in ENV | Secret exposure in image layers | Use Docker secrets or mount at runtime |
| Single RUN per command | Excessive layers | Chain related commands with && |
Not using .dockerignore |
Slow context transfer | Exclude unnecessary files |
| Installing unnecessary packages | Attack surface, image size | Install only required packages |
| No health checks | Unhealthy containers keep running | Add HEALTHCHECK directive |
Quick Troubleshooting
| Issue | Diagnosis | Fix |
|---|---|---|
| Build is slow | Large build context | Add .dockerignore, optimize layer caching |
| Image size too large | Dev dependencies, multiple stages | Multi-stage build, --only=production |
| "Permission denied" in container | Running as root, wrong file ownership | Use USER directive, COPY --chown |
| Build cache not working | COPY before dependency install | Copy package.json first, then install, then code |
| Container crashes immediately | Wrong CMD/ENTRYPOINT, missing deps | Check logs: docker logs <container> |
| Can't connect to database | Wrong network, wrong host | Use service name as host, check network |
| "Exec format error" | Wrong platform (ARM vs x86) | Build for correct platform: --platform linux/amd64 |
| Port not accessible | Not exposed or published | Use EXPOSE + docker run -p |
| Files not updating | Cached layers | Clear cache: docker build --no-cache |
| Volume data persists after deletion | Named volumes not removed | Use docker volume rm or docker-compose down -v |
Production Readiness
Security Configuration
# Security-hardened Dockerfile
FROM node:20-alpine AS builder
# Create non-root user
RUN addgroup -g 1001 appgroup && \
adduser -u 1001 -G appgroup -s /bin/sh -D appuser
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Production image
FROM node:20-alpine
# Security: install security updates
RUN apk update && apk upgrade && rm -rf /var/cache/apk/*
# Create non-root user
RUN addgroup -g 1001 appgroup && \
adduser -u 1001 -G appgroup -s /bin/sh -D appuser
WORKDIR /app
# Copy with correct ownership
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
COPY --
Установить docker в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditВложенные файлы
FAQ
Что делает скилл docker?
Docker containerization. Covers Dockerfile, images, and best practices. Use for containerizing applications. USE WHEN: user mentions "dockerfile", "docker build", "docker run", "containerize", "docker image", "multi-stage build", asks about "how to dockerize", "container security", "docker optimization", "image size", "docker layers" DO NOT USE FOR: docker-compose multi-service setups - use `docker-compose` skill instead, Kubernetes orchestration - use `kubernetes` skill instead
Как установить скилл docker?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл docker запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
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