Skip to main content
skill CX Codex

adding-docker — Claude Code skill: Dockerfile and compose

This skill writes a Dockerfile, docker-compose setup and .dockerignore for your app. Useful when you want a container without hand-writing the configs.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add spencerpauly/awesome-cursor-skills --skill adding-docker -a claude-code
Open on GitHub

What adding-docker does

The skill kicks in when you ask to dockerize or containerize an application. It starts by reading project manifests such as package.json, requirements.txt, go.mod or Cargo.toml to work out the language and runtime.

From there it writes a multi-stage Dockerfile with separate stages for dependencies, build and run. The Node.js example uses node:20-alpine, runs npm ci --omit=dev in the deps stage and ends with npm start. For your framework the agent adjusts the build output directory, the entry command and the base image. A .dockerignore lands next to it, covering node_modules, .next, .git and .env*.

When the app has a database or Redis, the skill generates a docker-compose.yml with the app service plus something like postgres:16-alpine. Secrets stay out of the image and go through env_file instead. The notes mention a HEALTHCHECK line for production deployments, so it is worth checking that it actually reaches your Dockerfile rather than staying a suggestion.

What it helps with

  • detect the language and runtime from project manifests
  • write a multi-stage Dockerfile for a specific framework
  • keep node_modules and .env out of the build context
  • run the app alongside its database via docker-compose
  • add npm scripts for building and running the container

Example prompts for the agent

  • dockerize this application
  • add Docker support to the project
  • set up docker-compose with postgres for this service

How to install adding-docker

1Skills CLI (Vercel)

npx skills add spencerpauly/awesome-cursor-skills --skill adding-docker -a claude-code

2Manually: put the files in place

~/.claude/skills/adding-docker/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/adding-docker/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about adding-docker

How do I install adding-docker in Claude?

Run npx skills add spencerpauly/awesome-cursor-skills --skill adding-docker -a claude-code. The skill file then sits at ~/.claude/skills/adding-docker/SKILL.md.

What does adding-docker do?

It writes a production-ready multi-stage Dockerfile, a .dockerignore and a docker-compose.yml when the app depends on something like a database or Redis.

Does it need any setup first?

The skill detects the runtime from your project manifests on its own. The compose example hardcodes database credentials, so move those into environment variables before deploying.

Source text

SKILL.md · CC0-1.0
---
name: adding-docker
description: Dockerize an application with a production-ready Dockerfile, docker-compose setup, and .dockerignore.
---

# Add Docker

Use this skill when the user asks to dockerize, containerize, or add Docker support to an application.

## Steps

1. **Detect the runtime** — inspect `package.json`, `requirements.txt`, `go.mod`, `Cargo.toml`, etc. to determine the language and runtime.

2. **Create a multi-stage `Dockerfile`**

   For Node.js (example):

   ```dockerfile
   FROM node:20-alpine AS base

   FROM base AS deps
   WORKDIR /app
   COPY package.json package-lock.json ./
   RUN npm ci --omit=dev

   FROM base AS build
   WORKDIR /app
   COPY package.json package-lock.json ./
   RUN npm ci
   COPY . .
   RUN npm run build

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

   Adapt for the detected framework — adjust the build output directory, entry command, and base image.

3. **Create `.dockerignore`**

   ```
   node_modules
   .next
   .git
   .env*
   *.md
   ```

4. **Create `docker-compose.yml`** (if the app has dependencies like a database or Redis):

   ```yaml
   services:
     app:
       build: .
       ports:
         - "3000:3000"
       env_file: .env
       depends_on:
         - db
     db:
       image: postgres:16-alpine
       environment:
         POSTGRES_DB: app
         POSTGRES_USER: postgres
         POSTGRES_PASSWORD: postgres
       volumes:
         - pgdata:/var/lib/postgresql/data
   volumes:
     pgdata:
   ```

5. **Add npm scripts** (optional)

   ```json
   {
     "docker:build": "docker build -t myapp .",
     "docker:run": "docker compose up"
   }
   ```

## Notes

- Use Alpine-based images to minimize image size.
- Never copy `.env` files into the image — use `env_file` or runtime injection.
- For monorepos, use a `.dockerignore` that excludes sibling packages not needed by the target app.
- Add a `HEALTHCHECK` instruction for production deployments.

© spencerpauly · CC0-1.0 · spencerpauly/awesome-cursor-skills

Similar skills

Everything for DevOps and infrastructure →

From the same set59

parallel-ci-triage Splits failed GitHub Actions jobs across parallel subagents, each fixing its own slice. Useful when CI breaks in several places at once. CX Codex +1 403installs screenshotting-changelog Builds a visual changelog for a pull request: captures pages before and after your UI edits and drops the image pairs into the PR body. CX Codex +1 401installs updating-npm-package Updates npm dependencies safely by checking npmjs.com and adapting to the version jump. It runs tests on minor updates and finds migration guides for major ones. CX Codex +1 398installs react-native-patterns This skill guides an agent building React Native and Expo apps, covering navigation, platform-specific code, styling, lists, and native modules. CX Codex +1 399installs fixing-broken-links This skill scans project files for dead URLs and broken local paths, verifies responses with curl, and repairs or removes missing links. CX Codex +1 393installs converting-css-modules-to-tailwind Moves one component off CSS Modules and onto Tailwind utility classes, then removes the module file and its import. CX Codex +1 392installs generating-images This skill generates and edits images through the OpenAI Image API on gpt-image-2. Handy when you need an OG banner, an icon or a mockup without leaving the agent chat. CX Codex +1 388installs adding-error-tracking This skill wires Sentry into a web app: error tracking, performance traces and source maps. Useful when you want crash reporting without hand-rolling the config. CX Codex +1 386installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor