mcpField
D
docker-expert

docker-expert

github.com/shipshitdevCloud & DevOps38208 installsUpdated today
Repository

About docker-expert

A skill for developers configuring Docker in NestJS and Next.js projects and managing containerized services. It covers Dockerfiles, Compose setups, networking, storage, health checks, and build practices.

Key features

  1. 01Create NestJS and Next.js Dockerfiles
  2. 02Configure Docker Compose services
  3. 03Set up container networks and volumes
  4. 04Add health checks and restart policies
  5. 05Apply multi-stage build practices

Use cases

  1. 01Containerize a NestJS or Next.js app
  2. 02Set up development and production Compose files
  3. 03Run Postgres or Redis in containers
  4. 04Improve image builds with caching

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/shipshitdev/skills --skill docker-expert

After installing, type/docker-expertin Claude Code to confirm it loaded.

Bundled filesplugin.json

Details

From the project README

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
  • Postgres/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
Postgres with Docker Compose
services:
  postgres:
    image: postgres:17
    container_name: postgres
    restart: unless-stopped
    ports:
      - "127.0.0.1:5432:5432"
    environment:
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: ${POSTGRES_DB}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - app-network
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  postgres_data:

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

Comments

Markdown supported