docker-patterns

Configures Docker Compose stacks, hardened Dockerfiles, networking, and volume strategies for containerized development.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/Femad-6/my-skills --skill docker-patterns-femad-6
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker-patterns
Source: https://github.com/Femad-6/my-skills/tree/main/.github/skills/docker-patterns
Command: npx skills add https://github.com/Femad-6/my-skills --skill docker-patterns-femad-6

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up reliable containerized development environments involves many pitfalls: broken service dependencies, leaked secrets, bloated images, and networking confusion. This Skill provides proven Docker and Docker Compose patterns so you can build secure, maintainable multi-container setups without trial and error. ## Core Features & Use Cases - Compose Stack Templates: Ready-made multi-service configurations with healthchecks, dependency ordering, and override files for dev versus production. - Dockerfile Hardening: Multi-stage builds with non-root users, pinned versions, read-only filesystems, and dropped capabilities. - Networking & Volumes: Service discovery via custom networks, bind mounts for hot reload, and named volumes for persistent data. - Use Case: You are starting a Node.js web app that needs PostgreSQL and Redis locally. Use this Skill to generate a docker-compose.yml with healthchecks, a hardened multi-stage Dockerfile, and a proper .dockerignore in minutes. ## Quick Start Use the docker-patterns skill to create a Docker Compose setup for my Node.js app with PostgreSQL and Redis, including a production-ready multi-stage Dockerfile.

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 each service in docker-compose.yml with build targets, port mappings, and environment variables. Use bind mounts for hot reload, anonymous volumes to protect node_modules, and healthchecks with depends_on conditions so services start in the correct order.

How do I write a secure multi-stage Dockerfile?

Use separate stages for dependencies, development, build, and production. Pin base images to specific versions, create a non-root user, copy only production artifacts into the final stage, and add a HEALTHCHECK instruction for monitoring.

How do Docker Compose services communicate with each other?

Services on the same Compose network resolve each other by service name as DNS hostnames. For isolation, define custom networks so, for example, a database is reachable only from the API tier and not from the frontend.

Should I use Docker Compose in production?

Docker Compose is designed for local development and single-host deployments. For production multi-container workloads, use an orchestrator such as Kubernetes, ECS, or Docker Swarm, which provide scaling, self-healing, and rolling updates.

Why is my container data lost after restart?

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

How do I manage secrets in Docker Compose?

Load secrets from a gitignored .env file via env_file or inherit them from the host environment. Never hardcode credentials in the Dockerfile or compose file; in Swarm mode, use Docker secrets backed by files.