docker
/docker
Use when writing Dockerfiles, Docker Compose files, or managing container images. Covers multi-stage builds, layer caching, Compose services, and image best practices. USE FOR: Dockerfiles, Docker Compose, multi-stage builds, container image optimization, local service orchestration DO NOT USE FOR: Kubernetes deployment (use kubernetes or helm), cloud provisioning (use terraform or pulumi), CI/CD pipelines (use dagger)
- Author
- Tyler-R-Kendrick ↗
- Repository
- agent-skills ↗
- Licence
- MIT
- Last repository change
- 09.06.2026
Assessment and security
- Files in this package
- 14
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 3
No signals detected. Repository changed on 09.06.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when writing Dockerfiles, Docker Compose files, or managing container images. Covers multi-stage builds, layer caching, Compose services, and image best practices. USE FOR: Dockerfiles, Docker Compose, multi-stage builds, container image optimization, local service orchestration DO NOT USE FOR: Kubernetes deployment (use kubernetes or helm), cloud provisioning (use terraform or pulumi), CI/CD pipelines (use dagger)
Original author description
Use when writing Dockerfiles, Docker Compose files, or managing container images. Covers multi-stage builds, layer caching, Compose services, and image best practices. USE FOR: Dockerfiles, Docker Compose, multi-stage builds, container image optimization, local service orchestration DO NOT USE FOR: Kubernetes deployment (use kubernetes or helm), cloud provisioning (use terraform or pulumi), CI/CD pipelines (use dagger)
How it works
- Overview
- Multi-Stage Dockerfile
- .NET Dockerfile
- Python Dockerfile
- Docker Compose
- Layer Caching
- Key Commands
- Best Practices
SKILL.md preview
---
name: docker
description: |
Use when writing Dockerfiles, Docker Compose files, or managing container images. Covers multi-stage builds, layer caching, Compose services, and image best practices.
USE FOR: Dockerfiles, Docker Compose, multi-stage builds, container image optimization, local service orchestration
DO NOT USE FOR: Kubernetes deployment (use kubernetes or helm), cloud provisioning (use terraform or pulumi), CI/CD pipelines (use dagger)
license: MIT
metadata:
displayName: "Docker"
author: "Tyler-R-Kendrick"
compatibility: claude, copilot, cursor
references:
- title: "Docker Documentation"
url: "https://docs.docker.com"
- title: "Dockerfile Reference"
url: "https://docs.docker.com/reference/dockerfile/"
- title: "Docker Compose Documentation"
url: "https://docs.docker.com/compose/"
---
# Docker
## Overview
Docker packages applications into containers — lightweight, portable, and reproducible environments. Dockerfiles define how images are built, and Docker Compose orchestrates multi-container applications for local development.
## Multi-Stage Dockerfile
```dockerfile
# Stage 1: Build
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Stage 2: Production
FROM node:22-alpine
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
EXPOSE 3000
USER node
CMD ["node", "dist/index.js"]
```
## .NET Dockerfile
```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY *.csproj ./
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
COPY --from=build /app .
EXPOSE 8080
USER $APP_UID
ENTRYPOINT ["dotnet", "MyApp.dll"]
```
## Python Dockerfile
```dockerfile
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
USER nobody
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
```
## Docker Compose
```yaml
services:
app:
build: .
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgresql://dev:devpass@db:5432/myapp
depends_on:
db:
condition: service_healthy
db:
image: postgres:16
environment:
POSTGRES_USER: dev
POSTGRES_PASSWORD: devpass
POSTGRES_DB: myapp
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U dev"]
interval: 5s
timeout: 3s
retries: 5
volumes:
pgdata:
```
## Layer Caching
Order instructions from least to most frequently changing:
```dockerfile
# 1. Base image (rarely changes)
FROM node:22-alpine
# 2. System dependencies (rarely changes)
RUN apk add --no-cache curl
# 3. Package manifests (changes when deps change)
COPY package*.json ./
RUN npm ci
# 4. Application code (changes frequently)
COPY . .
RUN npm run build
```
## Key Commands
```bash
# Build an image
docker build -t my-app:latest .
# Run a container
docker run -p 3000:3000 my-app:latest
# Start Compose services
docker compose up -d
# View logs
docker compose logs -f app
# Stop and remove
docker compose down -v
```
## Best Practices
- Use multi-stage builds to keep production images small (build deps stay in build stage).
- Use specific version tags (`node:22-alpine`) not `latest` for reproducibility.
- Run as a non-root user (`USER node`, `USER nobody`, `USER $APP_UID`).
- Use `.dockerignore` to exclude `node_modules/`, `.git/`, and other unnecessary files.
- Copy dependency manifests before source code to leverage layer caching.
- Use `--no-cache-dir` for pip installs to reduce image size.
- Use `depends_on` with `condition: service_healthy` in Compose for startup ordering.
- Use named volumes for persistent data (databases) and bind mounts for development source code.
Files in this package (14)
- AGENTS.md 3 KB
- README.md 1 KB
- SKILL.md 4 KB
- metadata.json 1 KB
- rules/_sections.md 2 KB
- rules/_template.md 1 KB
- rules/docker-copy-dependency-manifests-before-source-code-to-leverage.md 1 KB
- rules/docker-run-as-a-non-root-user-user-node-user-nobody-user.md 1 KB
- rules/docker-use-depends-on-with-condition.md 1 KB
- rules/docker-use-dockerignore-to-exclude-node-modules.md 1 KB
- rules/docker-use-multi-stage-builds-to-keep-production-images-small.md 1 KB
- rules/docker-use-named-volumes-for-persistent-data-databases-and-bind.md 1 KB
- rules/docker-use-no-cache-dir-for-pip-installs-to-reduce-image-size.md 1 KB
- rules/docker-use-specific-version-tags-node.md 1 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · Tyler-R-Kendrick/agent-skills | 100 | MIT |
| event4u-app/agent-config | 100 | MIT |
| ericrisco/rsc-harness | 100 | MIT |
| atomicbot-ai/atomic-agent | 100 | MIT |
| aleks-spv/sysaiadm_station | 100 | AGPL-3.0 |
| companion-inc/feynman | 100 | MIT |
| claude-dev-suite/claude-dev-suite | 100 | MIT |
| greedychipmunk/agent-skills | 100 | MIT |
| poppyszn/dev-pops-skills | 100 | MIT |
Database snapshot: 13.11.2026 · package version dd1abd8e20c1 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100docker-development
Docker and container development agent skill and plugin for Dockerfile optimization, docker-compose orchestration, multi-stage builds, and container security hardening. Use when: user wants to optimize a Dockerfile, create or improve docker-compose configurations, implement… - 95docker-patterns
Use this skill when the user says 'Dockerfile', 'Docker', 'Docker Compose', 'containerize', 'container', 'docker build', 'multi-stage build', 'docker-compose.yml', or when containerizing an application. Covers: multi-stage builds, non-root users, .dockerignore, layer caching,… - 100docker-expert
Expert Docker: Dockerfiles, multi-stage builds, image size/cache optimization, Compose, and container best practices. Trigger keywords: Docker, Dockerfile, container, image, multi-stage, layer cache, docker-compose, .dockerignore, entrypoint, distroless, non-root, healthcheck,… - 100docker-development
Use when optimising a Dockerfile, creating or improving docker-compose configurations, implementing multi-stage builds, auditing container security, or reducing image size. Triggers on "Dockerfile", "docker-compose", "container", "image size", "build cache", or "Docker best practices". - 95containerization-docker-best-practices
Comprehensive best practices for creating optimized, secure, and efficient Docker images and managing containers. Covers multi-stage builds, image layer optimization, security scanning, and runtime best practices. Triggers on:… - 100devops-docker-patterns
Docker containerization expert specializing in multi-stage builds, image optimization, Docker Compose patterns, and production container security. Use for Dockerfile optimization, compose configurations, and container best practices.