docker-patterns

Implements Docker and Docker Compose patterns for development, networking, volumes, and container security.

5|15|Updated Jul 8, 2026
One-click install
npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill docker-patterns-clfigueiredo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docker-patterns
Source: https://github.com/clfigueiredo/hermes-infra-skills/tree/main/.hermes/skills/curso-hermes/docker-patterns
Command: npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill docker-patterns-clfigueiredo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up reliable containerized development environments is error-prone: developers struggle with multi-service orchestration, container networking, data persistence, and insecure Dockerfile practices. This Skill provides proven Docker and Docker Compose patterns that eliminate guesswork. ## Core Features & Use Cases - Compose Stack Templates: Ready-to-adapt multi-service setups (app, PostgreSQL, Redis, Mailpit) with healthchecks, dependency ordering, and dev/prod override files. - Multi-Stage Dockerfiles: Separate dev, build, and production stages with non-root users, pinned image tags, and minimal production images. - Networking & Volumes: Custom network segmentation, service discovery by name, bind mounts for hot reload, and named volumes for persistence. - Security Hardening: no-new-privileges, read-only filesystems, capability dropping, secret management via .env files or Docker secrets, and anti-pattern checklists. - Use Case: You are starting a Node.js web app that needs PostgreSQL and Redis locally. Apply the standard Compose stack pattern, add a multi-stage Dockerfile, and get a hot-reload dev environment plus a hardened production image from the same codebase. ## Quick Start Ask the agent to set up a Docker Compose development environment for your web app with a database, following the docker-patterns best practices.

Frequently Asked Questions about docker-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Docker Compose for local development?▼

Define services in docker-compose.yml with build contexts, port mappings, bind mounts for hot reload, and healthchecks for dependencies like databases. Use depends_on with service_healthy conditions so the app starts only after the database is ready.

How to structure a multi-stage Dockerfile for production?▼

Use separate stages for dependencies, development, build, and production. The production stage copies only compiled output and production node_modules, runs as a non-root user, and includes a HEALTHCHECK instruction for monitoring.

How do Docker Compose override files work?▼

docker-compose.override.yml loads automatically alongside the base file for development settings like debug ports. For production, explicitly combine files with docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d.

Should I use Docker Compose in production?▼

Docker Compose alone is not recommended for production multi-container workloads. Use orchestrators like Kubernetes, ECS, or Docker Swarm instead, and reserve Compose for local development and simple single-host deployments.

How do I manage secrets in Docker Compose securely?▼

Load secrets from gitignored .env files via env_file, inherit them from the host environment, or use Docker secrets in Swarm mode. Never hardcode credentials in Dockerfiles or commit them to version control.

Why does my container lose data after restart?▼

Containers are ephemeral, so data written inside them disappears on removal. Mount a named volume to the data directory, such as pgdata:/var/lib/postgresql/data for PostgreSQL, to persist data across restarts.