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

docker-compose-generator

/docker-compose-generator

Generates multi-stage Dockerfiles and docker-compose configurations optimized for size, security, and development workflow. Covers common stacks including Node.js, Python, Java, and Go. Triggers on: "create Dockerfile", "docker-compose", "containerize", "docker setup".

Licence
MIT
Last repository change
16.09.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
3
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 16.09.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

Generates multi-stage Dockerfiles and docker-compose configurations optimized for size, security, and development workflow. Covers common stacks including Node.js, Python, Java, and Go. Triggers on: "create Dockerfile", "docker-compose", "containerize", "docker setup".

Triggers from the description

create Dockerfiledocker-composecontainerizedocker setup
Original author description

Generates multi-stage Dockerfiles and docker-compose configurations optimized for size, security, and development workflow. Covers common stacks including Node.js, Python, Java, and Go. Triggers on: "create Dockerfile", "docker-compose", "containerize", "docker setup".

How it works

  1. Instructions
  2. Example
  3. Guidelines
Original SKILL.md headings · 215 lines, 688 words
SKILL.md preview
---
name: docker-compose-generator
description: >
  Generates multi-stage Dockerfiles and docker-compose configurations optimized for size,
  security, and development workflow. Covers common stacks including Node.js, Python, Java, and Go.
  Triggers on: "create Dockerfile", "docker-compose", "containerize", "docker setup".
license: MIT
metadata:
  author: Community
  version: 1.0.0
  category: devops
---

# Docker Compose Generator

## Instructions

### Step 1: Identify the Stack

Ask:
1. What language/runtime? (Node.js, Python, Java, Go, Ruby, .NET)
2. What framework? (Express, FastAPI, Spring Boot, Gin, Rails)
3. What services are needed? (database, cache, message queue, search)
4. Is this for development, production, or both?
5. Any existing Dockerfile to improve?

### Step 2: Generate Multi-Stage Dockerfile

Use multi-stage builds to minimize image size:

**Node.js example:**
```dockerfile
# Stage 1: Dependencies
FROM node:20-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --only=production

# Stage 2: Build
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build

# Stage 3: Production
FROM node:20-alpine AS production
RUN addgroup -g 1001 -S appgroup && \
    adduser -S appuser -u 1001 -G appgroup
WORKDIR /app
COPY --from=deps --chown=appuser:appgroup /app/node_modules ./node_modules
COPY --from=build --chown=appuser:appgroup /app/dist ./dist
COPY --from=build --chown=appuser:appgroup /app/package.json ./
USER appuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
  CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
CMD ["node", "dist/index.js"]
```

**Python example:**
```dockerfile
FROM python:3.12-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

FROM base AS deps
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

FROM base AS production
RUN useradd --create-home --shell /bin/bash appuser
WORKDIR /app
COPY --from=deps /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=deps /usr/local/bin /usr/local/bin
COPY --chown=appuser:appuser . .
USER appuser
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=3s \
  CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
```

### Step 3: Security Best Practices

Apply these rules to every Dockerfile:

1. **Non-root user** - always add a user and switch with `USER`
2. **Minimal base images** - prefer `-alpine` or `-slim` variants
3. **Pin versions** - use exact tags, never `latest`
4. **No secrets in image** - use build args or runtime env vars
5. **Read-only filesystem** - set `read_only: true` in compose where possible
6. **Drop capabilities** - add `cap_drop: [ALL]` in compose
7. **Health checks** - always include HEALTHCHECK instruction
8. **Scan for vulnerabilities** - add `docker scout cves` to CI

### Step 4: Generate docker-compose.yml

Create a compose file for the development environment:

```yaml
version: "3.8"

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
      target: development
    ports:
      - "3000:3000"
    volumes:
      - .:/app
      - /app/node_modules
    environment:
      - NODE_ENV=development
      - DATABASE_URL=postgres://postgres:postgres@db:5432/appdb
      - REDIS_URL=redis://cache:6379
    depends_on:
      db:
        condition: service_healthy
      cache:
        condition: service_started
    restart: unless-stopped

  db:
    image: postgres:16-alpine
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: appdb
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 3s
      retries: 5

  cache:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    command: redis-server --maxmemory 128mb --maxmemory-policy allkeys-lru

volumes:
  pgdata:
```

### Step 5: Production Compose Overlay

For production, provide a `docker-compose.prod.yml` overlay:

```yaml
version: "3.8"

services:
  app:
    build:
      target: production
    volumes: []
    environment:
      - NODE_ENV=production
    deploy:
      replicas: 2
      resources:
        limits:
          cpus: "1.0"
          memory: 512M
      restart_policy:
        condition: on-failure
        max_attempts: 3
    read_only: true
    cap_drop:
      - ALL
    security_opt:
      - no-new-privileges:true

  db:
    environment:
      POSTGRES_PASSWORD_FILE: /run/secrets/db_password
    secrets:
      - db_password

secrets:
  db_password:
    external: true
```

Usage: `docker compose -f docker-compose.yml -f docker-compose.prod.yml up`

### Step 6: Common Service Snippets

Provide additional services as requested:

- **RabbitMQ:** `rabbitmq:3-management-alpine` with management UI on 15672
- **MongoDB:** `mongo:7` with init scripts in `/docker-entrypoint-initdb.d/`
- **Elasticsearch:** `elasticsearch:8.x` with single-node discovery
- **MinIO (S3-compatible):** `minio/minio` with console on 9001
- **Mailhog (dev email):** `mailhog/mailhog` with UI on 8025

## Example

User says: "Create a Docker setup for a Python FastAPI app with PostgreSQL and Redis"

Response:
- Multi-stage Dockerfile with slim base, non-root user, health check
- docker-compose.yml with app, postgres, redis services
- Volume mounts for hot reload in development
- Health check dependencies so app waits for DB
- .dockerignore file contents

## Guidelines

- Always use multi-stage builds for production images
- Never hardcode passwords in docker-compose files (use environment variables or secrets)
- Include .dockerignore in every project (exclude .git, node_modules, __pycache__, .env)
- Pin all image versions to specific tags
- Use health checks and depends_on with condition for startup ordering
- Default to Alpine-based images unless the app requires glibc
- Include resource limits in production configurations
- Provide both dev and prod configurations when asked for "Docker setup"
Files in this package (3)
  • SKILL.md 6 KB
  • evals/evals.json 2 KB
  • evals/trigger_evals.json 2 KB

Versions

The database has no other skills named docker-compose-generator.

Database snapshot: 13.11.2026 · package version dda43f101410 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · 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".
  • 100arn-infra-containerize
    This skill should be used when the user says "containerize", "dockerize", "create dockerfile", "docker setup", "container setup", "arn infra containerize", "infra containerize", "generate docker", "docker compose", "compose setup", "containerize my app", "docker configuration",…
  • 90docker
    Use when writing or reviewing Dockerfiles, docker-compose files, or .dockerignore for any backend service. Covers multi-stage builds, container security hardening, compose orchestration, advanced build patterns, and a Docker review checklist for all 4 stacks: NestJS/Node 24,…
  • 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
    Docker containerization. Covers Dockerfile, images, and best practices. Use for containerizing applications. USE WHEN: user mentions "dockerfile", "docker build", "docker run", "containerize", "docker image", "multi-stage build", asks about "how to dockerize", "container…
  • 100docker-best-practices
    Optimized Dockerfiles with multi-stage builds and security hardening. Use for container setup and docker-compose.

Feedback and reports

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