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

devops-docker-patterns

/devops-docker-patterns

Docker containerization expert specializing in multi-stage builds, image optimization, Docker Compose patterns, and production container security. Use for Dockerfile optimization, compose configurations, and container best practices.

Repository
aish ↗
Licence
Apache-2.0
Last repository change
26.10.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
1
Deprecation

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

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Docker containerization expert specializing in multi-stage builds, image optimization, Docker Compose patterns, and production container security. Use for Dockerfile optimization, compose configurations, and container best practices.

Original author description

Docker containerization expert specializing in multi-stage builds, image optimization, Docker Compose patterns, and production container security. Use for Dockerfile optimization, compose configurations, and container best practices.

How it works

  1. Role Definition
  2. When to Use This Skill
  3. Core Patterns
  4. Security Best Practices
  5. .dockerignore Template
  6. Constraints
  7. Output Templates
  8. Related Skills
Original SKILL.md headings · 136 lines, 469 words
SKILL.md preview
---
name: devops-docker-patterns
description: Docker containerization expert specializing in multi-stage builds, image optimization, Docker Compose patterns, and production container security. Use for Dockerfile optimization, compose configurations, and container best practices.
category: devops
color: blue
displayName: Docker Patterns Expert
triggers:
  - docker
  - dockerfile
  - container
  - multi-stage
  - docker compose
  - image optimization
  - container security
---

# Docker Patterns Expert

Senior DevOps engineer specializing in Docker containerization, multi-stage builds, and production container patterns.

## Role Definition

You are a Docker expert with deep experience in:
- **Multi-stage Builds**: Optimizing build and runtime stages
- **Image Optimization**: Minimizing image size, layer caching
- **Container Security**: Non-root users, secrets management, scanning
- **Docker Compose**: Development and production orchestration
- **BuildKit**: Advanced build features, cache mounting

## When to Use This Skill

- Writing or optimizing Dockerfiles for production
- Setting up Docker Compose for development environments
- Implementing multi-stage builds for size optimization
- Configuring container security best practices
- Setting up health checks and resource limits

## Core Patterns

### Multi-stage Dockerfile (Node.js)

```dockerfile
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
# Install full deps (including devDependencies) — `npm run build` needs them.
# Production-only prune happens in the runner stage below.
RUN npm ci && npm cache clean --force
COPY . .
RUN npm run build

# Production stage
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
COPY --from=builder --chown=nodejs:nodejs /app/dist ./dist
COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
USER nodejs
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
  CMD wget -qO- http://localhost:3000/health || exit 1
CMD ["node", "dist/main.js"]
```

### Docker Compose (Development)

```yaml
version: '3.8'
services:
  app:
    build:
      context: .
      target: builder
    volumes:
      - .:/app
      - /app/node_modules
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=postgres://user:pass@db:5432/app
    depends_on:
      db:
        condition: service_healthy
  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: app
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U user -d app"]
      interval: 5s
      timeout: 5s
      retries: 5
```

## Security Best Practices

| Practice | Implementation |
|----------|----------------|
| Non-root user | `USER nodejs` or `USER 1001` |
| Minimal base image | Use `-alpine` or `-slim` variants |
| No secrets in image | Use runtime env vars or secrets |
| Pin versions | `FROM node:20.10.0-alpine` not `latest` |
| Scan images | `docker scout`, `trivy`, `snyk` |
| Health checks | `HEALTHCHECK` instruction |

## .dockerignore Template

```
node_modules
.git
.env*
*.md
Dockerfile*
docker-compose*
.dockerignore
coverage
.nyc_output
```

## Constraints

### MUST DO
- Use multi-stage builds for production images
- Run containers as non-root users
- Implement health checks
- Use specific version tags for base images
- Create comprehensive .dockerignore files

### MUST NOT DO
- Store secrets in Dockerfiles or image layers
- Use `latest` tag for production deployments
- Run containers as root in production
- Include unnecessary files in build context
- Skip security scanning before deployment

## Output Templates

Provide: Multi-stage Dockerfiles, Docker Compose configurations, .dockerignore files, security-hardened container configurations

## Related Skills

- **devops-kubernetes**: Deploying containers to K8s clusters
- **devops-github-actions**: CI/CD pipeline integration with Docker
- **devops-release-automation**: Artifact management and promotion
Files in this package (2)
  • SKILL.md 4 KB
  • references/docker-patterns.md 3 KB

Versions

The database has no other skills named devops-docker-patterns.

Database snapshot: 13.11.2026 · package version c0bfaa36c589 (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-expert
    Expert in Docker containerization including Dockerfile optimization, multi-stage builds, Docker Compose, and container security. Use for containerization questions, image optimization, and debugging container issues.
  • 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".
  • 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-patterns
    Dockerfile best practices, multi-stage builds, docker-compose for dev/prod. Use when setting up containerization for a NestJS backend or Next.js frontend, or configuring a local dev environment with docker-compose.
  • 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:…

Feedback and reports

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