agentsclimarketplace

Docker containerization

Skill viktorbezdek/skillstack/docker-containerization/skills/docker-containerization

Skills I use and develop to deliver better outcomes faster and with less effort.

Install
npx -y skills add viktorbezdek/skillstack --skill docker-containerization

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 10 stars10 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Docker and container development — use when the user mentions Dockerfiles, multi-stage builds, Docker Compose, container optimization, image size reduction, DDEV, containerization, or dev environment setup with containers. NOT for CI/CD pipeline YAML or pipeline configuration (use cicd-pipelines), NOT for workflow orchestration or release automation (use workflow-automation), NOT for Kubernetes or container orchestration platforms (use cloud-native tooling).

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

10.5 KB, ~2.5k tokens by cl100k_base, as published. Nobody here has run it

Docker Containerization Skill

Comprehensive guide for Docker containerization: Dockerfiles, multi-stage builds, Docker Compose orchestration, development environments, and advanced patterns.

When to Use / Not Use

Use when:

  • Writing or optimizing Dockerfiles (multi-stage builds, layer caching, image size)
  • Setting up Docker Compose for multi-container apps (health checks, volumes, networks)
  • Creating isolated development environments with worktrees
  • Configuring DDEV for PHP/TYPO3 projects
  • Managing ports, browser isolation, and CORS in multi-worktree setups
  • Running container optimization analysis (scripts/docker_optimize.py)

Do NOT use when:

  • CI/CD pipeline YAML or pipeline configuration -> use cicd-pipelines
  • Workflow orchestration or release automation -> use workflow-automation
  • Kubernetes or container orchestration platforms -> use cloud-native tooling
  • Debugging containerized applications -> use debugging (but this skill helps with environment setup)

Decision Tree

What Docker task do you need?
├── Write a Dockerfile
│   ├── Single-language app, no build step -> Single-stage FROM + COPY + CMD
│   ├── Compiled/bundled app (TypeScript, Go, wheel) -> Multi-stage build (build + production)
│   ├── Need smallest image -> Alpine or distroless base, multi-stage
│   └── PHP/TYPO3 project -> DDEV (see references/ddev-quickstart.md)
├── Set up Docker Compose
│   ├── Single app + DB -> 2 services, health check on DB, depends_on with condition
│   ├── Multiple services (app + DB + cache + worker) -> Named volumes, health checks, resource limits
│   ├── Need worktree isolation -> Port ranges per worktree, prefixed container names
│   └── Environment-specific configs -> Override files: docker-compose.override.yml
├── Optimize existing image
│   ├── Image too large -> Run docker_optimize.py, add .dockerignore, reorder layers
│   ├── Build too slow -> Reorder: COPY deps first, RUN install, then COPY source
│   └── Security issues -> Non-root user, specific version tags, no build tools in production
├── Development environment
│   ├── Git worktree isolation -> references/docker-worktree-strategy.md + worktree-manager.sh
│   ├── Browser isolation for E2E -> references/browser-isolation.md + setup-mcp-isolation.sh
│   └── Port conflicts -> references/port-allocation.md (systematic ranges)
└── Troubleshooting
    ├── Build fails -> Check Dockerfile syntax, cache, .dockerignore
    ├── Container can't connect -> Check network, service names, health checks
    ├── Data lost on restart -> Use named volumes (not anonymous/binds)
    └── DDEV issues -> references/ddev-troubleshooting.md

Quick Start

Basic Docker Workflow

# Create Dockerfile
cat > Dockerfile <<EOF
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY . .
EXPOSE 3000
USER node
CMD ["node", "server.js"]
EOF

# Build and run
docker build -t myapp:1.0 .
docker run -d -p 3000:3000 --name myapp myapp:1.0

See: references/docker-basics.md

Docker Compose Multi-Container App

# docker-compose.yml
version: '3.8'
services:
  web:
    build: .
    ports:
      - "3000:3000"
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_healthy
    environment:
      - DATABASE_URL=postgresql://user:***@db:5432/app

  db:
    image: postgres:15-alpine
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "user"]
      interval: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      retries: 5

volumes:
  postgres_data:

See: references/docker-compose.md

Core Docker Concepts

Dockerfile Best Practices

# Use specific versions (not latest)
FROM node:20.11.0-alpine3.19

# Set working directory
WORKDIR /app

# Copy dependency files first (better caching)
COPY package*.json ./
RUN npm ci --only=production

# Copy application code
COPY . .

# Set environment variables
ENV NODE_ENV=production

# Document exposed ports
EXPOSE 3000

# Create and use non-root user (security)
RUN addgroup -g 1001 -S nodejs && \
    adduser -S nodejs -u 1001
USER nodejs

# Default command
CMD ["node", "server.js"]

Multi-Stage Builds

# Stage 1: Build
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

# Stage 2: Production (smaller image)
FROM node:20-alpine
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
USER node
EXPOSE 3000
CMD ["node", "dist/server.js"]

Benefits: Smaller images, improved security, no build tools in production.

.dockerignore

node_modules
.git
.env
*.log
.DS_Store
README.md
docker-compose.yml
dist
coverage

Anti-Patterns

Anti-PatternProblemSolution
Using FROM:latest tagNon-reproducible builds; breakage when base image updatesPin specific version: node:20.11.0-alpine3.19
Running as root in productionSecurity vulnerability; container escape riskCreate non-root user: RUN adduser -S appuser then USER appuser
Single-stage build for compiled appsBuild tools and dev deps in production image (1GB+ vs 200MB)Multi-stage build: compile in build stage, copy artifacts to slim production stage
No .dockerignorenode_modules, .git, build artifacts copied into image, bloating sizeCreate .dockerignore excluding node_modules, .git, dist, coverage, .env
No health checks in ComposeServices start before dependencies ready; connection refused errorsAdd healthcheck to each service, use depends_on: condition: service_healthy
Anonymous volumes for datadocker compose down removes data; data loss on cleanupUse named volumes: volumes: { postgres_data: } and reference by name
COPY all files before RUN installAny source change invalidates dependency cache; slow rebuildsCOPY package*.json first, RUN install, then COPY source (dependency layer caches)
No restart policy in productionContainer stays down after crash or host rebootAdd restart: unless-stopped to production services
No resource limitsRunaway container starves host; OOM kills other servicesSet deploy.resources.limits.memory and cpus per service
Missing EXPOSE documentationUnclear which ports the container uses; conflictsDocument with EXPOSE even though it doesn't publish ports
Separate RUN chown after COPYCreates extra layer; wastes image spaceUse COPY --chown=appuser:appgroup in one step

Best Practices

Dockerfiles

  • Use specific image versions, not latest
  • Run as non-root user
  • Multi-stage builds to minimize size
  • Implement health checks
  • Set resource limits
  • Keep images under 500MB
  • Scan for vulnerabilities regularly

Docker Compose

  • Use named volumes for data persistence
  • Implement health checks for all services
  • Set restart policies for production
  • Use environment-specific compose files
  • Configure resource limits
  • Enable logging with size limits
  • Network isolation with custom networks

Development Environments

  • Use consistent port allocation across worktrees
  • Isolate browser state for parallel testing
  • Copy .env files when creating worktrees
  • Configure CORS for worktree frontend ports
  • Stop services when not in use

Quick Reference

TaskCommand
Builddocker build -t myapp:1.0 .
Rundocker run -d -p 8080:3000 myapp:1.0
Logsdocker logs -f myapp
Shelldocker exec -it myapp /bin/sh
Stopdocker stop myapp
Removedocker rm myapp
Compose updocker compose up -d
Compose downdocker compose down
Clean alldocker system prune -a --volumes

Scripts Reference

ScriptPurpose
scripts/docker_optimize.pyAnalyze and optimize Dockerfiles
scripts/validate-prerequisites.shCheck Docker, DDEV installation
scripts/worktree-manager.shManage isolated worktree environments
scripts/setup-mcp-isolation.shConfigure browser MCP isolation
scripts/validate-worktree-connectivity.shTest worktree service connectivity
scripts/test-isolation.shTest browser isolation
scripts/migrate-browser-isolation.shMigrate to new isolation config

Reference Navigation

TopicReference File
Docker basics and Dockerfilereferences/docker-basics.md
Docker Compose orchestrationreferences/docker-compose.md
Extended patterns and examplesreferences/extended-patterns.md
Ghostmind meta.json configreferences/docker-meta-config.md
Worktree Docker strategyreferences/docker-worktree-strategy.md
Port allocationreferences/port-allocation.md
Browser isolationreferences/browser-isolation.md
CORS configurationreferences/cors-configuration.md
Docker troubleshootingreferences/docker-troubleshooting.md
DDEV quickstartreferences/ddev-quickstart.md
DDEV advanced optionsreferences/ddev-advanced-options.md
DDEV prerequisitesreferences/ddev-prerequisites.md
DDEV troubleshootingreferences/ddev-troubleshooting.md

Resources

Integration

  • cicd-pipelines -- Build and deploy Docker images this skill creates
  • workflow-automation -- Automate deployment workflows using Docker containers
  • debugging -- Debug containerized applications and CI/CD failures
  • testing-framework -- Set up testing infrastructure inside containers

Gives 0 of the 12 instructions most project setup skills give in ~2.5k tokens

Counted across 999 of the 1,637 authors here whose files we hold, read 2026-08-07

  • ask one question at a timein 29 of 999, across 28 files
  • detect the package manager from lockfilesin 28 of 999, across 9 files
  • present findings to the userin 26 of 999, across 5 files
  • explore current repo statein 24 of 999, across 3 files
  • update the agent skills block in place if it existsin 24 of 999, across 3 files
  • install husky lint-staged and prettierin 23 of 999, across 4 files
  • create the lintstagedrc filein 22 of 999, across 3 files
  • commit all changed filesin 22 of 999, across 3 files
  • run lint-staged to verify it worksin 22 of 999, across 3 files
  • create the husky pre-commit filein 21 of 999, across 2 files
  • create a prettierrc file if missingin 21 of 999, across 2 files
  • initialize huskyin 21 of 999, across 2 files

Said here and by no other author read

  • use specific image versions
  • set restart policies for production services
  • use environment-specific compose override files
  • keep images under 500MB
  • scan images for vulnerabilities regularly

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.