Skip to content
Skills Library
DevOps & cloud · Building & coding

docker

/docker

Build, run, and secure Docker containers with current best practices. Use for Dockerfile review, multi-stage builds, Compose orchestration, image hardening, and CI/CD integration.

Licence
MIT
Last repository change
09.08.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
8
Deprecation

No signals detected. Repository changed on 09.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Build, run, and secure Docker containers with current best practices. Use for Dockerfile review, multi-stage builds, Compose orchestration, image hardening, and CI/CD integration.

Original author description

Build, run, and secure Docker containers with current best practices. Use for Dockerfile review, multi-stage builds, Compose orchestration, image hardening, and CI/CD integration.

How it works

  1. Current Versions (Verify Before Use)
  2. Core Principles
  3. Dockerfile Review Checklist
  4. Multi-Stage Build Template
  5. Docker Compose Patterns
  6. Security Scanning
  7. Common Anti-Patterns
  8. CI/CD Integration
  9. Troubleshooting Flow
  10. Official Resources
Original SKILL.md headings · 159 lines, 756 words
SKILL.md preview
---
name: docker
description: Build, run, and secure Docker containers with current best practices. Use for Dockerfile review, multi-stage builds, Compose orchestration, image hardening, and CI/CD integration.
metadata:
  category: user-invoked
disable-model-invocation: true
---

Default output: return only the result, blockers, and required evidence. Omit preambles, process narration, repeated context, confidence scores, and follow-up offers. Use at most five bullets unless a required artifact or schema needs more.

# Docker Container Engineering

## Current Versions (Verify Before Use)

```bash
docker --version          # Engine version
docker compose version    # Compose plugin version
docker buildx version     # BuildKit/buildx version
```

Check the [Docker Engine release notes](https://docs.docker.com/engine/release-notes/) for the latest stable.

## Core Principles

1. **Multi-stage builds are the default.** Every production Dockerfile should use multi-stage builds to minimize attack surface and image size.
2. **Non-root containers.** Every container should run as a non-root user unless impossible.
3. **Layer caching is a first-class concern.** Order Dockerfile instructions from least-frequently-changing to most-frequently-changing.
4. **Healthchecks are mandatory.** Every long-running container must define a `HEALTHCHECK`.
5. **Scan before push.** Every image should pass a security scan before registry upload.

## Dockerfile Review Checklist

### Structure
- [ ] Uses multi-stage build (at least 2 stages: builder + runtime)
- [ ] Base image is a slim or distroless variant (`alpine`, `slim`, `distroless`)
- [ ] No `latest` tag — pinned to specific digest or version
- [ ] `WORKDIR` is set before file operations
- [ ] `COPY` uses specific files, not `COPY . .` where possible

### Security
- [ ] Runs as non-root (`USER` directive or `--user` at runtime)
- [ ] No secrets in layers (use BuildKit secrets or runtime mounts)
- [ ] `EXPOSE` documents only necessary ports
- [ ] `HEALTHCHECK` is defined
- [ ] No unnecessary packages installed (`apt-get` cleaned, no dev tools in runtime)
- [ ] Image scanned with `docker scout` or Trivy

### Efficiency
- [ ] `.dockerignore` exists and excludes: `.git`, `node_modules`, `*.log`, `.env`
- [ ] Layer order respects cache invalidation (dependencies before code)
- [ ] `RUN` commands combined where logical (but not excessively long)
- [ ] BuildKit enabled (`DOCKER_BUILDKIT=1` or default in modern Docker)

## Multi-Stage Build Template

```dockerfile
# syntax=docker/dockerfile:1
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json .
RUN npm ci --only=production

FROM node:22-alpine AS runtime
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
WORKDIR /app
COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
COPY --chown=nodejs:nodejs . .
USER nodejs
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
  CMD node -e "require('http').get('http://localhost:3000/health', (r) => r.statusCode === 200 ? process.exit(0) : process.exit(1))"
CMD ["node", "server.js"]
```

## Docker Compose Patterns

### Development vs Production Separation
```yaml
# docker-compose.yml — production baseline
services:
  app:
    build: .
    restart: unless-stopped
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 512M
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
      interval: 30s
      timeout: 3s
      retries: 3
```

```yaml
# docker-compose.override.yml — development only
services:
  app:
    volumes:
      - .:/app
    environment:
      - NODE_ENV=development
    command: npm run dev
```

### Validation
```bash
docker compose config              # validate and merge
docker compose config --profiles   # check profile separation
```

## Security Scanning

```bash
# Docker Scout (built-in, requires login)
docker scout quickview myimage:latest
docker scout cves myimage:latest

# Trivy (open source)
trivy image myimage:latest
trivy filesystem .

# Snyk
snyk container test myimage:latest
```

## Common Anti-Patterns

| Anti-Pattern | Why It's Wrong | Fix |
|---|---|---|
| `FROM node:latest` | Non-reproducible builds, surprise updates | Pin to `node:22-alpine` or digest |
| Running as root | Container escape = host compromise | `USER` directive + file ownership |
| `COPY . .` without `.dockerignore` | Bloats image, leaks secrets | Explicit `.dockerignore` |
| `apt-get update && apt-get install` without cleanup | Bloated layers | `&& rm -rf /var/lib/apt/lists/*` |
| No healthcheck | Orchestrator can't detect failure | `HEALTHCHECK` in Dockerfile or compose |
| Secrets in ENV | Visible in `docker inspect` | BuildKit secrets or runtime mounts |
| Single-stage build | Large attack surface, slow deploys | Multi-stage: build → runtime |

## CI/CD Integration

```yaml
# .github/workflows/docker.yml
- name: Build and scan
  run: |
    docker build -t app:${{ github.sha }} .
    docker scout cves app:${{ github.sha }} --exit-code --only-severity critical,high
    docker run --rm app:${{ github.sha }} npm test
```

## Troubleshooting Flow

1. **Build fails:** Check layer cache — `docker build --no-cache` to isolate
2. **Image too large:** Run `dive myimage:latest` to analyze layer bloat
3. **Container exits immediately:** Check `CMD`/`ENTRYPOINT` and logs (`docker logs`)
4. **Permission denied:** Verify `USER` directive and file ownership in `COPY --chown`
5. **Healthcheck failing:** Test command inside container with `docker exec`

## Official Resources

- [Dockerfile reference](https://docs.docker.com/engine/reference/builder/)
- [Compose specification](https://docs.docker.com/compose/compose-file/)
- [Docker security best practices](https://docs.docker.com/develop/dev-best-practices/)
- [BuildKit documentation](https://docs.docker.com/build/buildkit/)
- [Docker Scout](https://docs.docker.com/scout/)
Files in this package (2)
  • SKILL.md 6 KB
  • evals/evals.json 1 KB

Versions

RepositoryScoreLicence
This page · v1truv1us/ai-eng-system100MIT
event4u-app/agent-config100MIT
ericrisco/rsc-harness100MIT
atomicbot-ai/atomic-agent100MIT
aleks-spv/sysaiadm_station100AGPL-3.0
companion-inc/feynman100MIT
claude-dev-suite/claude-dev-suite100MIT
greedychipmunk/agent-skills100MIT
poppyszn/dev-pops-skills100MIT

Identical content appears in 1 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version fe21a8f80f59 (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
    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:…
  • 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…
  • 100docker-patterns
    Provides Docker and Docker Compose patterns including multi-stage builds, networking, volumes, and production configurations. Use when working with Dockerfile or docker-compose.yml, or when the user mentions Docker, containers, or containerization.
  • 100docker-best-practices
    Optimized Dockerfiles with multi-stage builds and security hardening. Use for container setup and docker-compose.
  • 100docker-development
    This skill should be used when the user asks to "analyze a Dockerfile", "optimize Docker layers", "validate docker-compose", "check container best practices", or "audit Docker configurations".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.