docker-helper
БесплатноБез исполняемых скриптовНе проверенBuild, debug, and optimize Docker configurations. Use when a user asks to create a Dockerfile, fix Docker build errors, optimize image size, write…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Docker Helper
Overview
Create, debug, and optimize Docker configurations including Dockerfiles, docker-compose setups, and container troubleshooting. Follows Docker best practices for security, image size, and build speed.
Instructions
When a user asks for help with Docker, determine which task they need:
Task A: Create a Dockerfile
- Identify the application language and framework.
docker initcan generate a starting Dockerfile,compose.yamland.dockerignorefor common stacks; review its output before keeping it. - Choose the right base image (prefer
-slimor-alpinevariants, and a currently supported release: Node 20 reached end of life in April 2026, so use an LTS such as 24 or 22). - Use multi-stage builds for compiled or bundled apps.
- Order instructions for layer caching:
# Stage 1: build (needs dev dependencies)
FROM node:24-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build && npm prune --omit=dev
# Stage 2: runtime
FROM node:24-alpine
ENV NODE_ENV=production
WORKDIR /app
COPY --from=builder --chown=node:node /app/dist ./dist
COPY --from=builder --chown=node:node /app/node_modules ./node_modules
COPY --from=builder --chown=node:node /app/package.json ./
USER node
EXPOSE 3000
CMD ["node", "dist/index.js"]
The official Node images already ship a non-root node user. Installing with npm ci --omit=dev in the builder would break npm run build when the build tool is a dev dependency; prune afterwards instead. (--only=production is the deprecated spelling of --omit=dev.)
Key rules:
- Copy dependency files first, then source (caching)
- Run as a non-root user (
USERbeforeCMD) - Use
.dockerignoreto excludenode_modules,.git,.env - Pin base images to a version tag (e.g.
node:24.8-alpine); for reproducible builds pin the digest too (image@sha256:...) - Chain related
RUNsteps with&&so cleanup happens in the same layer
Task B: Write compose.yaml
Docker Compose v2 is the docker compose plugin (not the old docker-compose binary). The top-level version: key is obsolete and only produces a warning; omit it. The preferred file name is compose.yaml (docker-compose.yml is still read).
services:
app:
build: .
ports:
- "3000:3000"
environment:
DATABASE_URL: postgres://orders:${POSTGRES_PASSWORD:?set it in .env}@db:5432/orders
depends_on:
db:
condition: service_healthy
restart: unless-stopped
db:
image: postgres:18-alpine
volumes:
- pgdata:/var/lib/postgresql
environment:
POSTGRES_USER: orders
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set it in .env}
POSTGRES_DB: orders
healthcheck:
test: ["CMD-SHELL", "pg_isready -U orders -d orders"]
interval: 5s
timeout: 5s
retries: 5
volumes:
pgdata:
Run it with docker compose up -d --wait (waits until services are healthy), check with docker compose ps, and validate the merged file with docker compose config.
Key rules:
- Use
depends_onwithcondition: service_healthy, not just service names - Use named volumes for persistent data. Postgres 18 images keep data in a versioned subdirectory of
/var/lib/postgresql, so mount the volume there; for 17 and older the mount point is/var/lib/postgresql/data - Keep secrets out of the file: read them from
.env(interpolation, as above) or use Composesecrets: - Set restart policies
- For local development,
docker compose watchwith adevelop.watchsection syncs or rebuilds on file changes
Task C: Debug container issues
Follow this diagnostic sequence:
# 1. Check container status
docker ps -a
# 2. Read container logs
docker logs web --tail 50
# 3. Inspect container details (exit code, OOM kill, health)
docker inspect --format '{{json .State}}' web
# 4. Check resource usage
docker stats --no-stream
# 5. Get a shell inside the container
docker exec -it web /bin/sh
# 6. Check networking
docker network ls
docker network inspect orders_default
For Compose projects, use docker compose logs -f app and docker compose ps. If the image has no shell, docker run --rm -it --entrypoint sh <image> or docker debug <container> (Docker Desktop / subscription feature) helps.
Common issues and fixes:
- Container exits immediately: check logs; usually a missing env var or config file.
docker inspectshowsExitCode(137 usually means killed, often out of memory) - Port already in use:
lsof -i :3000to find the conflict - Cannot connect between containers: put them on the same network and use service names as hostnames, never
localhost - Out of disk space:
docker system dfshows usage;docker system pruneremoves stopped containers, unused networks and dangling images. Add-a(all unused images) or--volumesonly after checking what they will delete, since volumes hold data - Build fails at COPY:
Установить docker-helper в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл docker-helper?
Build, debug, and optimize Docker configurations. Use when a user asks to create a Dockerfile, fix Docker build errors, optimize image size, write docker-compose files, debug container issues, set up multi-stage builds, or troubleshoot networking between containers. Covers Dockerfile best practices and compose orchestration.
Как установить скилл docker-helper?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл docker-helper запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic