Skip to content
Skillv1.0.0

docker-expert

Expert in Docker, docker-compose, Dockerfile patterns, and container orchestration for NestJS and Next.js applications. Use this skill when users need Docker setup, containerization, or docker-compose

by shipshitdev(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from shipshitdev/skills (skills/docker-expert/SKILL.md). Install upstream with npx skills add shipshitdev/skills --skill docker-expert. Copyright stays with the author.

Docker Expert

When to Use

  • Dockerfile creation for NestJS/Next.js
  • docker-compose configuration
  • Container networking and volumes
  • Multi-stage builds optimization
  • Health checks and restart policies
  • MongoDB/Redis container setup

Dockerfile Best Practices

NestJS Multi-Stage Build

FROM node:20-alpine AS base
WORKDIR /app

FROM base AS deps
COPY package*.json ./
RUN npm ci

FROM base AS builder
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build

FROM base AS runner
ENV NODE_ENV=production
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3001
CMD ["node", "dist/main.js"]

Next.js Dockerfile

FROM node:20-alpine AS base
WORKDIR /app

FROM base AS deps
COPY package*.json ./
RUN npm ci

FROM base AS builder
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build

FROM base AS runner
ENV NODE_ENV=production
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
EXPOSE 3000
CMD ["npm", "start"]

Docker Compose Patterns

Development Setup

  • Use volumes for live reload
  • Mount source code
  • Set restart: unless-stopped
  • Configure networks

Production Setup

  • Use named volumes for persistence
  • Set restart policies
  • Configure health checks
  • Use secrets management

MongoDB with Docker Compose

services:
  mongodb:
    image: mongo:7.0
    container_name: mongodb
    restart: unless-stopped
    ports:
      - "27017:27017"
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USERNAME}
      MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD}
    volumes:
      - mongodb_data:/data/db
    networks:
      - app-network
    command: mongod --auth

Health Checks

healthcheck:
  test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
  interval: 30s
  timeout: 10s
  retries: 3
  start_period: 40s

Best Practices

  • Use multi-stage builds to reduce image size
  • Leverage layer caching
  • Use .dockerignore
  • Set appropriate restart policies
  • Use health checks for containers
  • Mount volumes for persistent data
  • Use networks for service isolation

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/shipshitdev-skills-docker-expert/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

shipshitdev-skills-docker-expert.ocm.jsonjson
{
  "ocm": "1",
  "id": "shipshitdev-skills-docker-expert",
  "kind": "skill",
  "name": "docker-expert",
  "description": "Expert in Docker, docker-compose, Dockerfile patterns, and container orchestration for NestJS and Next.js applications. Use this skill when users need Docker setup, containerization, or docker-compose configuration.",
  "publisher": "shipshitdev",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "docker",
      "containers",
      "infrastructure",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Expert in Docker, docker-compose, Dockerfile patterns, and container orchestration for NestJS and Next.js applications. Use this skill when users need Docker setup, containerization, or docker-compose configuration."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/shipshitdev/skills",
      "path": "skills/docker-expert/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/shipshitdev/skills/blob/HEAD/skills/docker-expert/SKILL.md",
      "key": "shipshitdev/skills/skills/docker-expert/SKILL.md"
    }
  },
  "instructions": "# Docker Expert\n\n## When to Use\n\n- Dockerfile creation for NestJS/Next.js\n- docker-compose configuration\n- Container networking and volumes\n- Multi-stage builds optimization\n- Health checks and restart policies\n- MongoDB/Redis container setup\n\n## Dockerfile Best Practices\n\n### NestJS Multi-Stage Build\n\n```dockerfile\nFROM node:20-alpine AS base\nWORKDIR /app\n\nFROM base AS deps\nCOPY package*.json ./\nRUN npm ci\n\nFROM base AS builder\nCOPY --from=deps /app/node_modules ./node_modules\nCOPY . .\nRUN npm run build\n\nFROM base AS runner\nENV NODE_ENV=production\nCOPY --from=builder /app/dist ./dist\nCOPY --f",
  "cost": {
    "context_tokens": 577
  }
}

Fetch it by URL: GET /api/v1/registry/shipshitdev-skills-docker-expert/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.