docker-patterns

Provide Docker and Docker Compose patterns for local multi-service development environments.

Updated Feb 5, 2026
One-click install
npx skills add https://github.com/gugug168/claudecode-tutorial --skill docker-patterns-gugug168
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker-patterns
Source: https://github.com/gugug168/claudecode-tutorial/tree/main/everything-claude-code-learning/02-Skills/docker-patterns
Command: npx skills add https://github.com/gugug168/claudecode-tutorial --skill docker-patterns-gugug168

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides clear Docker and Docker Compose patterns to simplify creating and maintaining local multi-container development environments, reduce configuration drift between development and production, and address common issues with networking, volumes, and image security.

Core Features & Use Cases

  • Compose development stacks: multi-stage build targets, override files for development vs production, bind mounts for hot reload, and named volumes for persistent data.
  • Networking & volume strategies: service discovery via Compose networks, custom network segmentation, and guidance on named, anonymous, and bind-mounted volumes.
  • Container hardening: non-root users, pinned image tags, dropped capabilities, read-only file systems, healthchecks, and secret/environment best practices.
  • Use Case: Run a web app with a Postgres database, Redis, and a local mail testing service where the developer iterates quickly with hot reload while preserving DB state and ensuring production image hardening.

Quick Start

Start a Docker Compose development stack using a dev build target with source bind mounts for hot reload, named volumes for data persistence, healthchecks enabled, and a production multi-stage Dockerfile configured to run as a non-root user.

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 a Docker Compose development stack with hot reload and persistent database volumes?

Set up a Docker Compose development stack using a dev build target with source bind mounts for hot reload and named volumes for data persistence. Healthchecks and non-root production Dockerfiles ensure a reproducible multi-service environment.

What's the best way to harden a Dockerfile for production containers?

Harden Docker containers by configuring a non-root runtime user, pinning image tags, dropping capabilities, and applying read-only file systems. Adding healthchecks and secure environment variable handling further secures the production image.

How does Docker Compose handle networking and service discovery for multi-container applications?

Docker Compose handles multi-container networking through custom service networks and network segmentation. This enables automatic service discovery, allowing your web app to communicate seamlessly with Postgres and Redis containers.

Can I use different Docker Compose override files for development and production environments?

You can use Docker Compose override files to manage different development and production environments. This reduces configuration drift by applying dev-specific bind mounts for hot reload while maintaining strict production hardening rules.

Why do I lose my database data when restarting my local Docker development stack?

You lose database data because anonymous volumes are recreated on container removal. Define named volumes in your Docker Compose file to persist database state across container restarts during local development.

What are multi-stage Docker builds and when do I need them for local development?

Multi-stage Docker builds separate the build environment from the final runtime image. You need them to create smaller, secure production images while maintaining a dev target with hot reload for local development.