docker-containerization — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited docker-containerization (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Comprehensive guide for Docker containerization: Dockerfiles, multi-stage builds, Docker Compose orchestration, development environments, and advanced patterns.
Use when:
scripts/docker_optimize.py)Do NOT use when:
cicd-pipelinesworkflow-automationdebugging (but this skill helps with environment setup)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# 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.0See: references/docker-basics.md
# 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
# 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"]# 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.
node_modules
.git
.env
*.log
.DS_Store
README.md
docker-compose.yml
dist
coverage| Anti-Pattern | Problem | Solution |
|---|---|---|
Using FROM:latest tag | Non-reproducible builds; breakage when base image updates | Pin specific version: node:20.11.0-alpine3.19 |
| Running as root in production | Security vulnerability; container escape risk | Create non-root user: RUN adduser -S appuser then USER appuser |
| Single-stage build for compiled apps | Build tools and dev deps in production image (1GB+ vs 200MB) | Multi-stage build: compile in build stage, copy artifacts to slim production stage |
| No .dockerignore | node_modules, .git, build artifacts copied into image, bloating size | Create .dockerignore excluding node_modules, .git, dist, coverage, .env |
| No health checks in Compose | Services start before dependencies ready; connection refused errors | Add healthcheck to each service, use depends_on: condition: service_healthy |
| Anonymous volumes for data | docker compose down removes data; data loss on cleanup | Use named volumes: volumes: { postgres_data: } and reference by name |
| COPY all files before RUN install | Any source change invalidates dependency cache; slow rebuilds | COPY package*.json first, RUN install, then COPY source (dependency layer caches) |
| No restart policy in production | Container stays down after crash or host reboot | Add restart: unless-stopped to production services |
| No resource limits | Runaway container starves host; OOM kills other services | Set deploy.resources.limits.memory and cpus per service |
Missing EXPOSE documentation | Unclear which ports the container uses; conflicts | Document with EXPOSE even though it doesn't publish ports |
Separate RUN chown after COPY | Creates extra layer; wastes image space | Use COPY --chown=appuser:appgroup in one step |
latest| Task | Command |
|---|---|
| Build | docker build -t myapp:1.0 . |
| Run | docker run -d -p 8080:3000 myapp:1.0 |
| Logs | docker logs -f myapp |
| Shell | docker exec -it myapp /bin/sh |
| Stop | docker stop myapp |
| Remove | docker rm myapp |
| Compose up | docker compose up -d |
| Compose down | docker compose down |
| Clean all | docker system prune -a --volumes |
| Script | Purpose |
|---|---|
scripts/docker_optimize.py | Analyze and optimize Dockerfiles |
scripts/validate-prerequisites.sh | Check Docker, DDEV installation |
scripts/worktree-manager.sh | Manage isolated worktree environments |
scripts/setup-mcp-isolation.sh | Configure browser MCP isolation |
scripts/validate-worktree-connectivity.sh | Test worktree service connectivity |
scripts/test-isolation.sh | Test browser isolation |
scripts/migrate-browser-isolation.sh | Migrate to new isolation config |
| Topic | Reference File |
|---|---|
| Docker basics and Dockerfile | references/docker-basics.md |
| Docker Compose orchestration | references/docker-compose.md |
| Extended patterns and examples | references/extended-patterns.md |
| Ghostmind meta.json config | references/docker-meta-config.md |
| Worktree Docker strategy | references/docker-worktree-strategy.md |
| Port allocation | references/port-allocation.md |
| Browser isolation | references/browser-isolation.md |
| CORS configuration | references/cors-configuration.md |
| Docker troubleshooting | references/docker-troubleshooting.md |
| DDEV quickstart | references/ddev-quickstart.md |
| DDEV advanced options | references/ddev-advanced-options.md |
| DDEV prerequisites | references/ddev-prerequisites.md |
| DDEV troubleshooting | references/ddev-troubleshooting.md |
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.