docker-patterns

Automate Docker pattern adoption across projects with multi-stage builds and Compose orchestration.

7|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/Jonathan0823/opencode-config --skill docker-patterns-jonathan0823
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker-patterns
Source: https://github.com/Jonathan0823/opencode-config/tree/main/skills/docker-patterns
Command: npx skills add https://github.com/Jonathan0823/opencode-config --skill docker-patterns-jonathan0823

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill consolidates Docker best practices, patterns, and deployment guidance to help teams build secure, efficient, and maintainable containers.

Core Features & Use Cases

  • Multi-Stage Builds: Optimize images by separating build and runtime environments.
  • Security Hardening: Enforce non-root users, minimal base images, and restricted capabilities.
  • Layer Caching: Structure Dockerfiles to maximize cache hits and reduce build times.
  • Health Checks: Standardize health probes and restart policies.
  • Docker Compose Patterns: Streamline development and production orchestration with compose files and services.

Quick Start

Install Docker and review the references/dockerfile-patterns.md and references/docker-compose-patterns.md to understand the recommended patterns. Then audit your Dockerfiles and Docker Compose configurations to apply multi-stage builds, non-root users, and minimal images. Finally, run a local test environment to validate health checks and network isolation.

Frequently Asked Questions about docker-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I secure Docker containers using non-root users and minimal base images?

Docker security hardening involves enforcing non-root users, utilizing minimal base images, and restricting capabilities to minimize vulnerabilities. This Skill provides reference patterns and sample configurations to systematically apply these security measures across containerized applications.

What is the best way to optimize Docker images with multi-stage builds?

Multi-stage builds optimize Docker images by separating the build and runtime environments, discarding unnecessary build dependencies. This approach reduces final image size and attack surface while ensuring only production-ready artifacts are included in the deployed container.

How do I structure Dockerfiles to maximize layer caching and reduce build times?

To maximize layer caching, structure Dockerfiles by ordering instructions from least to most frequently changing, placing dependency installation before source code copying. This Skill offers reference patterns to optimize cache hits and reduce build times.

How do I standardize health checks and restart policies in Docker Compose?

Standardizing health probes and restart policies in Docker Compose ensures service reliability and automated recovery from failures. This Skill provides orchestration patterns for development and production environments to streamline health check implementation across multi-service architectures.

Do I need Docker installed locally to apply these deployment patterns?

Yes, applying the deployment patterns, references, and sample configurations requires Docker installed locally or in a CI environment. The Skill provides documentation and patterns that must be validated by running a local test environment to ensure health checks and network isolation function correctly.

How do I audit existing Dockerfiles to apply security and efficiency best practices?

Auditing involves reviewing existing Dockerfiles and Docker Compose configurations against recommended patterns for multi-stage builds, non-root users, and minimal images. This Skill consolidates best practices to identify gaps and systematically adopt secure, efficient, and maintainable container configurations.