docker

Docker containerization for development and production. Covers Dockerfiles, multi-stage builds, layer caching, Compose services, networking, volumes, health checks, security hardening, and production deployment patterns. Use when writing Dockerfiles, optimizing image size, configuring Compose services, debugging container networking, setting up health checks, hardening containers for production, or troubleshooting build cache issues.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "docker" with this command: npx skills add oakoss/agent-skills/oakoss-agent-skills-docker

Docker

Overview

Docker packages applications into isolated containers that run consistently across environments. A Dockerfile defines the image build steps, Compose orchestrates multi-container services, and production patterns ensure small, secure, performant images.

When to use: Containerizing applications, creating reproducible dev environments, orchestrating multi-service stacks, deploying to container platforms (ECS, Kubernetes, Fly.io, Railway, Coolify).

When NOT to use: Simple static sites with no backend (use CDN deploy), single-binary CLI tools (distribute the binary), or when the target platform has native buildpacks (Heroku, Vercel) and you don't need container control.

Quick Reference

PatternApproachKey Points
Multi-stage buildSeparate builder and production stages80%+ image size reduction, no dev deps in production
Layer cachingCopy lockfile first, install, then copy sourceDependency layer cached across builds
Non-root userRUN adduser + USER in final stageNever run production containers as root
Health checkHEALTHCHECK CMD curl or node/python checkEnables orchestrator restart on failure
.dockerignoreExclude node_modules, .git, .envSmaller build context, faster builds
Compose servicescompose.yaml with service definitionsDev environment in one command
Compose overridecompose.prod.yaml with production settingsEnvironment-specific config without duplication
Named volumesvolumes: in Compose for persistent dataSurvives container recreation
Build cache mountRUN --mount=type=cache,target=/root/.npmPersistent cache across builds
Secrets in buildRUN --mount=type=secret,id=tokenNever bake secrets into image layers
Image pinningPin to major.minor or digestReproducible builds, avoid surprise breakage
Container networkingCustom bridge networks with service discoveryContainers resolve each other by service name
Compose watchdevelop.watch with sync/rebuild actionsLive reload without volume mounts
Init process--init flag or tini entrypointProper signal handling and zombie reaping
Multi-platformdocker buildx build --platformARM (Apple Silicon, Graviton) + x86 in one image
Monorepo pruneturbo prune app --dockerMinimal build context from workspace dependencies
CI layer cachingcache-from/cache-to with GHA or registryAvoid full rebuilds in CI pipelines
Debug containersdocker exec, docker logs, diveInspect running containers and image layers

Common Mistakes

MistakeCorrect Pattern
Installing dev dependencies in production imageMulti-stage build: install in builder, copy artifacts to runtime
Copying source before installing dependenciesCopy lockfile first, npm ci, then copy source for cache reuse
Running as root in productionCreate non-root user, USER directive in final stage
Hardcoding secrets in Dockerfile or ENVUse build secrets (--mount=type=secret) or runtime env
Using latest tag for base imagesPin to specific version (node:24-alpine)
No .dockerignore fileExclude node_modules, .git, .env, build artifacts
Using npm install instead of npm cinpm ci for deterministic, lockfile-based installs
HEALTHCHECK missingAdd health check for orchestrator integration
Large base images (node:24)Use alpine variants (node:24-alpine) for smaller images
Ignoring .env file precedence in Composeenvironment: in Compose overrides .env file values
Building entire monorepo for one serviceUse turbo prune --docker for minimal build context
No layer caching in CIUse cache-from/cache-to with GHA or registry backend
Building only for x86 when deploying to ARMUse docker buildx with --platform linux/amd64,linux/arm64

Delegation

  • Dockerfile review: Use Task agent to audit Dockerfiles for size, security, and caching
  • Compose exploration: Use Explore agent to discover existing Docker configurations
  • Architecture decisions: Use Plan agent for container orchestration strategy

If the ci-cd-architecture skill is available, delegate CI/CD pipeline and deployment strategy to it. If the application-security skill is available, delegate container security scanning and hardening review to it.

References

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Security

application-security

No summary provided by upstream source.

Repository SourceNeeds Review
Security

database-security

No summary provided by upstream source.

Repository SourceNeeds Review
Security

quality-auditor

No summary provided by upstream source.

Repository SourceNeeds Review
docker | V50.AI