docker-patterns

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

5|Updated Jul 8, 2019
One-click install
npx skills add https://github.com/rinchsan/dotfiles --skill docker-patterns-rinchsan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker-patterns
Source: https://github.com/rinchsan/dotfiles/tree/main/.claude/skills/docker-patterns
Command: npx skills add https://github.com/rinchsan/dotfiles --skill docker-patterns-rinchsan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up reliable containerized development environments involves many decisions around Compose configuration, networking, volumes, and security, and mistakes lead to broken builds, data loss, or insecure containers. ## Core Features & Use Cases - Compose Stack Templates: Ready-to-adapt multi-service setups with healthchecks, dependency ordering, and override files for dev versus production. - Networking and Volume Guidance: Patterns for service discovery, network segmentation, bind mounts, named volumes, and protecting container directories like node_modules. - Security Hardening: Dockerfile and Compose practices covering non-root users, read-only filesystems, capability dropping, and secret management. - Use Case: When starting a new web app with Postgres and Redis, apply the standard Compose stack pattern with healthchecks and a multi-stage Dockerfile to get a working local environment quickly. ## Quick Start Ask the AI to set up a Docker Compose development environment for a Node.js app with Postgres 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 Postgres. Use an anonymous volume for node_modules so container dependencies are not overwritten by the host bind mount.

How do Docker Compose services communicate with each other?

Services on the same Compose network resolve each other by service name via built-in DNS. For example, the app container connects to Postgres using the hostname db and to Redis using the hostname redis.

Should I use different Dockerfiles for development and production?

Use a single multi-stage Dockerfile with separate dev, build, and production stages. Target the dev stage in Compose for hot reload, and the production stage for a minimal image running as a non-root user.

How do I manage secrets in Docker Compose securely?

Load secrets from a gitignored .env file via env_file or inherit them from the host environment, and use Docker secrets in Swarm mode. Never hardcode credentials in the Dockerfile or commit them to docker-compose.yml.

Why does my container lose data after restart?

Containers are ephemeral, so data written inside them disappears on removal. Mount a named volume such as pgdata to the database data directory to persist data across container restarts.

When should I not use Docker Compose in production?

Docker Compose is designed for single-host local development, not production orchestration. For production multi-container workloads, use Kubernetes, ECS, or Docker Swarm instead.