Skip to content
Back to skills

Docker

ASecurity

Write optimised Dockerfiles with multi-stage builds, security hardening, and Compose orchestration. Use when authoring, reviewing, or optimizing container artifacts for: (1) Multi-stage Dockerfiles for Go, Node.js, Python, or Rust, (2) Container security hardening including non-root USER, minimal base images, and secret mounts, (3) Docker Compose orchestration definitions, healthchecks, and networking, or (4) Docker build performance and layer caching optimization.

  • 2 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 29, 2026
ai-agentspythonrustgonodedockersecurityperformance

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 29, 2026

npx -y skills add talkops-ai/opscode --skill docker --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docker?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docker
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/talkops-ai-docker/badge)](https://www.skillsdirectory.com/skills/talkops-ai-docker)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: docker
description: "Write optimised Dockerfiles with multi-stage builds, security hardening, and Compose orchestration. Use when authoring, reviewing, or optimizing container artifacts for: (1) Multi-stage Dockerfiles for Go, Node.js, Python, or Rust, (2) Container security hardening including non-root USER, minimal base images, and secret mounts, (3) Docker Compose orchestration definitions, healthchecks, and networking, or (4) Docker build performance and layer caching optimization."
license: MIT
compatibility: designed for opscode
---

# Docker (Multi-Stage Builds, Security Hardening & Compose)

Guidelines for building lightweight, secure, and production-ready Docker containers and multi-service Docker Compose stacks.

## Quick Workflow

1. **Multi-Stage Build Pipeline**: Separate build dependencies from runtime dependencies using multi-stage builds (`AS builder`, `AS runner`).
2. **Layer Caching Optimization**: Copy lockfiles/manifests first, run dependency downloads with BuildKit cache mounts (`--mount=type=cache`), then copy application source.
3. **Security Hardening**: Enforce non-root execution (`USER nonroot` or dedicated UID/GID), select minimal base images (Distroless or Alpine), and drop Linux capabilities.
4. **Secrets Protection**: Use BuildKit secret mounts (`--mount=type=secret`) during build and Docker Compose secrets for runtime. Never hardcode credentials in `ENV` or `ARG`.
5. **Orchestration with Compose v2**: Define multi-container services with healthchecks (`condition: service_healthy`), internal networks, and resource limits.

---

## Detailed References

- **Multi-Stage Dockerfile Templates**: See [references/dockerfile-patterns.md](references/dockerfile-patterns.md) for production multi-stage Dockerfiles for Node.js, Python, Go, and Rust.
- **Security Hardening**: See [references/security-hardening.md](references/security-hardening.md) for non-root setup, distroless images, read-only root filesystems, and capability drops.
- **Docker Compose Orchestration**: See [references/compose-orchestration.md](references/compose-orchestration.md) for Docker Compose v2 patterns, network segmentation, healthcheck dependencies, and secret mounting.

---

## Production Container Checklist

- [ ] **Multi-Stage Separation**: Build toolchains (compilers, dev dependencies) excluded from final runtime image.
- [ ] **Non-Root User**: Container runs as explicit non-root user (`USER appuser` or `USER nonroot`).
- [ ] **Minimal Base Image**: Base image uses Alpine, Distroless, or minimal slim distributions.
- [ ] **Build Caching**: Dependencies installed before copying application source; BuildKit cache mounts applied.
- [ ] **Secret Hygiene**: No credentials stored in `ENV`, `ARG`, or image layers.
- [ ] **Compose Healthchecks**: Services use `depends_on` with `condition: service_healthy` for startup dependencies.

Files in this skill

  • SKILL.md2.8 KB
  • references/compose-orchestration.md2 KB
  • references/dockerfile-patterns.md2.8 KB
  • references/security-hardening.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.