docker-patterns

Provides Docker and Docker Compose patterns for development stacks, security hardening, and installer testing.

2|Updated Mar 29, 2015
One-click install
npx skills add https://github.com/ovisan/dotfiles --skill docker-patterns-ovisan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker-patterns
Source: https://github.com/ovisan/dotfiles/tree/main/.agents/skills/docker-patterns
Command: npx skills add https://github.com/ovisan/dotfiles --skill docker-patterns-ovisan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing correct Dockerfiles and Compose configurations involves many subtle decisions around multi-stage builds, networking, volumes, secrets, and security hardening, and mistakes lead to bloated images, leaked credentials, or broken local environments. ## Core Features & Use Cases - Compose Stack Templates: Standard web app stacks with Postgres, Redis, and Mailpit, including healthchecks, dependency ordering, and dev/prod override files. - Security Hardening: Non-root users, pinned image tags, read-only filesystems, capability dropping, and proper secret management via env files or Docker secrets. - Hardened Installer Test Harnesses: Isolated container patterns for testing CLI installers across Linux distributions with read-only mounts, tmpfs workspaces, and no-network defaults, plus honest guidance on macOS and Windows platform boundaries. - Use Case: When setting up a new Node.js project, apply the multi-stage Dockerfile and Compose override patterns to get hot-reload development and a minimal production image from one configuration. ## Quick Start Ask the AI to create a production-hardened Dockerfile and docker-compose.yml for a Node.js web app with Postgres and Redis.

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 with hot reload?

Bind mount your source code into the container and add an anonymous volume for node_modules so host files do not overwrite container dependencies. Use a dev target in a multi-stage Dockerfile and a docker-compose.override.yml for debug-only settings.

How do I write a multi-stage Dockerfile for Node.js production?

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

Can Docker containers test macOS or Windows installer behavior?

No. Docker shares a Linux kernel, so Linux containers cannot validate macOS or Windows behavior. Run the same test entry point natively on macOS and Windows CI runners, and reserve Windows containers for a Windows Docker host.

How do I manage secrets in Docker Compose securely?

Use a gitignored .env file loaded via env_file, inherit variables from the host environment, or use Docker secrets in Swarm mode. Never hardcode credentials in Dockerfiles or commit them into image layers.

Why should containers run as a non-root user?

Running as root lets a compromised process escalate privileges on the host. Create a dedicated user in the Dockerfile, set USER before CMD, and combine with no-new-privileges, cap_drop ALL, and a read-only root filesystem.

When should I not use Docker Compose in production?

Docker Compose is designed for single-host development, not production orchestration. For production multi-container workloads, use Kubernetes, ECS, or Docker Swarm, which provide scheduling, scaling, and self-healing.