Skip to content
Back to skills

Docker Setup

BSecurity

Dockerfile and Docker Compose patterns with multi-stage builds, layer optimization, security hardening, and health checks. Use when containerizing applications, writing Dockerfiles, or setting up Docker Compose environments.

  • 57 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 17, 2026
securitytypescriptpythonnodedockergitsecurity

Security analysis

B88/100
  • criticalExfiltrates credentials via HTTP — exact pattern from Snyk ToxicSkills study

Pro shows the line behind each finding and how to fix it

Scanned October 17, 2026

npx -y skills add diegosouzapw/awesome-omni-skill --skill docker-setup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docker Setup?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docker Setup
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/diegosouzapw-docker-setup/badge)](https://www.skillsdirectory.com/skills/diegosouzapw-docker-setup)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: docker-setup
description: Dockerfile and Docker Compose patterns with multi-stage builds, layer optimization, security hardening, and health checks. Use when containerizing applications, writing Dockerfiles, or setting up Docker Compose environments.
compatibility: Requires Docker
metadata:
  version: "1.0"
---

# Docker Setup

## Decision Tree

```
New container needed → What stack?
    ├─ Node/TypeScript → Use assets/Dockerfile.node.template
    ├─ Python → Use assets/Dockerfile.python.template
    └─ Other → Follow multi-stage pattern below
```

## Multi-Stage Build Pattern

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

# Stage 2: Production
FROM node:20-alpine
RUN addgroup -S app && adduser -S app -G app
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
USER app
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:3000/health || exit 1
CMD ["node", "dist/index.js"]
```

## Layer Optimization Rules

1. **COPY package files before source** - Dependency layer caches separately
2. **Use .dockerignore** - Exclude node_modules, .git, .env, tests
3. **Combine RUN commands** - Fewer layers = smaller image
4. **Use alpine bases** - 5MB vs 100MB+ for full images
5. **Pin versions** - `node:20.11-alpine` not `node:latest`

## Security Checklist

- [ ] Non-root USER in final stage
- [ ] No secrets in build args or ENV
- [ ] .dockerignore excludes .env, .git, node_modules, tests
- [ ] Base image pinned to specific version
- [ ] HEALTHCHECK defined
- [ ] No unnecessary packages installed

## For Compose patterns see:
- [Docker Compose patterns](references/compose-patterns.md)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.