docker-patterns

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

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/pjherron/hypoc --skill docker-patterns-pjherron
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docker-patterns
Source: https://github.com/pjherron/hypoc/tree/main/hypoc/skills/docker-patterns
Command: npx skills add https://github.com/pjherron/hypoc --skill docker-patterns-pjherron

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up reliable containerized development environments involves many decisions around Compose configuration, networking, volumes, and security hardening, and mistakes lead to broken builds, leaked secrets, or lost data. ## Core Features & Use Cases - Compose Stack Templates: Ready-made multi-service setups with healthchecks, dependency ordering, and override files for dev versus production. - Multi-Stage Dockerfiles: Separate dev, build, and production stages with non-root users and minimal production images. - Networking and Volumes: Service discovery by name, custom network segmentation, and bind mount versus named volume strategies. - Security Hardening: Non-root execution, dropped capabilities, read-only filesystems, and secret management via env files or Docker secrets. - Use Case: When scaffolding a new web app with PostgreSQL and Redis, apply the standard Compose stack pattern with healthchecks and a hardened production Dockerfile instead of writing configuration from scratch. ## Quick Start Ask the agent to set up a Docker Compose development environment for a Node.js app with PostgreSQL and Redis using these patterns.

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 targets, port mappings, bind mounts for hot reload, and healthchecked dependencies like PostgreSQL. Use an anonymous volume for node_modules so container dependencies are not overwritten by the host bind mount.

How do I separate dev and production Docker builds?▼

Use a multi-stage Dockerfile with distinct dev, build, and production stages, then target the appropriate stage in Compose. Combine a base docker-compose.yml with an auto-loaded override file for dev and an explicit prod file for production.

How do Docker Compose containers communicate with each other?▼

Services on the same Compose network resolve each other by service name, so the app connects to postgres://db:5432 or redis://redis:6379 directly. Custom networks can isolate tiers, for example keeping the database reachable only from the API service.

How do I manage secrets in Docker Compose securely?▼

Inject secrets at runtime through a gitignored .env file or host environment variables, or use Docker secrets in Swarm mode. Never hardcode credentials in the Dockerfile or commit them into image layers.

Why does my container lose data after restart?▼

Containers are ephemeral, so data written inside them disappears on removal unless stored in volumes. Mount a named volume such as pgdata to /var/lib/postgresql/data to persist database files across restarts.

When should I not use Docker Compose in production?▼

Docker Compose is suited to local development and single-host setups, not production multi-container orchestration. For production workloads, use Kubernetes, ECS, or Docker Swarm for scheduling, scaling, and failover.