docker-management

Installation
SKILL.md

Docker Management

When to Load

Load this skill when the task involves Dockerfile authoring, Compose stack design, container registry operations, multi-stage build optimization, production container patterns, or troubleshooting container runtimes.

Core Concepts

Dockerfiles

  • Multi-stage builds: Separate build-time dependencies from runtime image — FROM ... AS builder for compilation, final FROM for minimal runtime. Drastically reduces image size
  • Layer optimization: Each RUN, COPY, ADD creates a layer. Order from least-to-most frequently changing (system deps first, app code last). Combine RUN apt-get update && apt-get install -y ... && rm -rf /var/lib/apt/lists/* in one RUN to avoid caching stale package lists
  • Best practices: Use specific base image tags (not :latest), COPY --chown for non-root user, HEALTHCHECK instruction, LABEL for metadata, EXPOSE for documentation, ENTRYPOINT + CMD pattern for flexible default commands, .dockerignore for build context size

Docker Compose

  • Service definition: image (build locally or pull), build (context + Dockerfile + args), ports, volumes, environment, depends_on, healthcheck, restart, networks
  • Production concerns: Named volumes (not bind mounts for persistent data), network isolation (separate frontend/backend/db networks), restart policies (unless-stopped), CPU/memory limits (deploy.resources), logging driver (json-file with rotation, or journald)
  • Multi-file compose: docker-compose -f docker-compose.yml -f docker-compose.prod.yml config for override layers, docker-compose.yml (base) + docker-compose.override.yml (dev, gitignored) by convention
Installs
1
GitHub Stars
167
First Seen
14 days ago
docker-management — magnus919/hermes-profiles