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.
npx skills add spencerpauly/awesome-cursor-skills --skill adding-docker -a claude-codeWhat 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-code2Manually: put the files in place
~/.claude/skills/adding-docker/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/adding-docker/
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill adding-docker -a codex2Manually: put the files in place
.agents/skills/adding-docker/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill adding-docker -a cursor2Manually: put the files in place
.cursor/skills/adding-docker/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install spencerpauly/awesome-cursor-skills adding-docker2Manually: put the files in place
.github/skills/adding-docker/SKILL.md1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill adding-docker -a gemini-cli2Platform CLI
gemini skills install https://github.com/spencerpauly/awesome-cursor-skills --path resources/adding-dockerManually: put the files in place
.devin/skills/adding-docker/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill adding-docker -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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