Docker Development

Docker and container development agent skill and plugin for Dockerfile optimization, docker-compose orchestration, multi-stage builds, and container security hardening.

Development / Engineeringdevelopmentengineering
by AgentVoltv1.0.0Published 1y ago1 install
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

PromptOptimize our production Dockerfile for size and security
Beforegeneric AI agent
Optimizing Dockerfiles involves a few techniques. Multi-stage builds can help reduce image size by splitting build and runtime layers. Security-wise, you'd want to think about what dependencies are actually needed and avoid running as root. Do you have a current Dockerfile you want to improve? What base image are you using? Are you deploying to Kubernetes or traditional VMs? The specifics matter for what optimizations make sense.
Afterwith Docker Development
PRODUCTION DOCKERFILE: OPTIMIZED MULTI-STAGE BUILD

→ STAGE 1: BUILDER (dependencies + compilation)
  FROM node:20-alpine AS builder
  WORKDIR /app
  COPY package*.json ./
  RUN npm ci --only=production \  # Only prod deps (excludes dev tooling)
    && npm cache clean --force
  COPY . .
  RUN npm run build  # Compile TypeScript/assets
  
  Size after stage 1: 450MB (includes build tools, temp files – doesn't matter)
  Trap: Avoid RUN npm install (reinstalls dev deps); use npm ci for locked versions

→ STAGE 2: RUNTIME (final production image)
  FROM node:20-alpine  # Slim base (140MB vs 900MB with ubuntu)
  
  # Security: Create non-root user
  RUN addgroup -g 1001 -S nodejs
  RUN adduser -S nodejs -u 1001
  
  WORKDIR /app
  COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
  COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
  COPY --from=builder --chown=nodejs:nodejs /app/package*.json ./
  
  USER nodejs  # Switch to non-root (prevents container breakout)
  EXPOSE 3000
  CMD ["node", "dist/server.js"]
  
  Final size: ~220MB (node_modules + dist + base image)
  Reduction: 75% smaller than single-stage (900MB → 220MB)

→ LAYER CACHING STRATEGY (speeds up rebuilds)
  Order matters: Copy package.json BEFORE source code
  Logic: package changes infrequently; source changes often
  If source changes: Skip npm ci rebuild (cache hit)
  If package changes: Only rebuild node_modules (cache miss on layer 3)
  Example rebuild time: 45s with cache vs. 4min without

→ SECURITY HARDENING
  ✓ Non-root user (USER nodejs, uid 1001 – prevents root exploits)
  ✓ Alpine base (smaller attack surface, fewer packages)
  ✓ No secrets in Dockerfile (use Docker secrets or env vars at runtime)
  ✓ Scan image: docker scout cves (catches known vulnerabilities in base image)
  ✓ Read-only root: Add --read-only flag in orchestrator (Kubernetes, etc.)
  ✓ Pin base image version: node:20.8-alpine not node:20-alpine (fixed point-in-time)
  Trap: Running as root in production is #1 vulnerability – don't skip USER line

→ RUNTIME OPTIMIZATIONS
  Environment: NODE_ENV=production (skips dev dependencies in app startup)
  Memory: Set JVM/Node heap if needed (--memory=512m in docker run)
  Health check: Add HEALTHCHECK instruction (orchestrator knows container status)

→ DEPLOYMENT CHECKLIST
  ✓ Build locally: docker build -t myapp:latest .
  ✓ Test: docker run -u 1001 myapp:latest (verify non-root works)
  ✓ Scan: docker scout cves myapp:latest (zero critical vulns)
  ✓ Size check: docker images | grep myapp (should be <300MB)
  ✓ Push to registry: docker push myregistry.com/myapp:v1.0.0
  ✓ Verify in prod: k logs pod/myapp (confirm app starts, no permission errors)

About this skill


name: docker-development description: Use when Docker and container development agent skill and plugin for Dockerfile optimization, docker-compose orchestration, multi-stage builds, and container security hardening.

Docker 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 multi-stage builds, audit container security, reduce image size, or follow container best practices. Covers build performance, layer caching, secret management, and production-ready container patterns.

What you get

  • Public GitHub repo (alirezarezvani/claude-skills)
  • the docker-development skill folder with SKILL.md. Part of a 337-skill / 30-agent / 70-command install.

Customize your output

  • Fork the repo and adapt the skill's instructions and references to your workflow.

Example output

Activates automatically when your request matches Docker Development; chains with the other skills, agents, and commands in the collection.

Best for

Creators, builders, and teams using Claude Code.

SKILL.md preview

SKILL.md
---
name: docker-development
description: Use when optimizing a Dockerfile, building or improving docker-compose configurations, implementing multi-stage builds, or auditing container security.
version: 1.0.0
category: Development / Engineering
author: AgentVolt
license: proprietary
tags:
  - development
  - engineering
---

# Docker Development

Covers Dockerfile optimization, docker-compose orchestration, multi-stage builds, and container security hardening for production-ready images.

## When to use
- A Dockerfile produces a bloated image and needs size reduction

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →