dockerize
Skill2 starsChanged 10 months agoMITView on GitHub
Analyze repositories to detect tech stacks, dependencies, and services, then generate production-ready Dockerfiles and compose.yml configurations. This skill should be used when users ask to containerize a project, create Docker configs, or set up a development/production environment for their codebase.
- Reads credentials
- Deletes or force-pushes
- Installs packages
3 other projects use a version of this.
Adopted by
Most recently taken up by
- OneByJorah/VirtOfficetheir own version, first seen Nov 1, 2026
- OneByJorah/offivotheir own version, first seen Oct 20, 2026
- Pradnyeshp/Claude-Skillstheir own version, first seen Jul 6, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- OneByJorah/offivo★ 24same name
- OneByJorah/VirtOffice★ 24same name
- Pradnyeshp/Claude-Skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository3 other files it gives its agents.
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 12 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 109
Use --no-install-recommends to skip suggested packages you don't need.
- Distinctive: line 113
Default Docker containers run as root.
- Distinctive: line 139
Check something meaningful (DB connectivity, not just "process exists")
- Distinctive: line 140
Keep checks lightweight (they run frequently)
- Distinctive: line 144
Don't ship debug tools, test suites, or dev dependencies to production.
- Very specific: line 261
Check package.json scripts: start, dev, build, serve
- Very specific: line 262
Look for main or module fields
- Very specific: line 266
Check for main.py, app.py, run.py, manage.py
- Very specific: line 267
Look at pyproject.toml [tool.poetry.scripts] or [project.scripts]
- Distinctive: line 268
Check for ASGI/WSGI entry points (uvicorn, gunicorn configs)
- Very specific: line 271
Look for main.go in root or cmd/ directory
- Very specific: line 272
Check go.mod for module name
- Very specific: line 275
Check Cargo.toml for [[bin]] targets
- Distinctive: line 280
Follow these best practices when generating Dockerfiles:
- Distinctive: line 372
When generating Docker configurations, provide:
- Distinctive: line 383
Run full analysis workflow
- Distinctive: line 389
Add Redis service with appropriate configuration
- Distinctive: line 390
Update app service with depends_on if needed
- Distinctive: line 400
Environment Variables: Never hardcode secrets. Use environment variables or Docker secrets
- Distinctive: line 402
Health Checks: Add appropriate health check endpoints when detected
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Dockerize Skill
This skill analyzes codebases to automatically generate Docker configurations for containerized deployment.
Critical Docker Best Practices (MUST FOLLOW)
1. NEVER Use latest Tag
WRONG:
FROM node:latest
FROM python:latest
FROM nginx:latestRIGHT:
FROM node:20.11.1-alpine3.19
FROM python:3.12.2-slim-bookworm
FROM nginx:1.25.4-alpine3.19latest is a moving target. What works today may break tomorrow when the base image updates. Production deployments have failed due to unexpected base image changes. Pin versions for reproducible builds.
2. Use Minimal Base Images
Bloated images = larger attack surface, slower pulls, higher storage costs.
| Instead of | Use | Size Reduction |
ubuntu:22.04 | python:3.12-slim | ~90% smaller |
node:20 | node:20-alpine | ~80% smaller |
python:3.12 | python:3.12-slim | ~85% smaller |
For production, consider distroless images where possible.
3. NEVER Put Secrets in Dockerfiles
CATASTROPHICALLY WRONG:
ENV AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
ENV AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/...
ARG NPM_TOKEN=abc123Secrets baked into images are extractable by anyone with image access. They persist in layer history, registries, and CI logs.
CORRECT - Use BuildKit secret mounts for build-time secrets:
# Secret available during build but NOT persisted in layer
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ciCORRECT - Pass secrets at runtime:
docker run -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID myappCORRECT - Use secrets management:
- Docker Swarm secrets
- Kubernetes secrets
- HashiCorp Vault, AWS Secrets Manager
4. Optimize Layer Caching
Order by change frequency (least → most). Wrong order means npm/pip install runs from scratch on every code change.
WRONG (cache invalidated on ANY file change):
COPY . .
RUN npm installRIGHT (npm install cached unless package.json changes):
COPY package.json package-lock.json ./
RUN npm ci
COPY . .This single change can cut build times from 8 minutes to under 1 minute.
5. Combine RUN Commands
Each instruction creates a layer. Cleanup in a later layer doesn't save space.
WRONG (4 layers, cleanup doesn't work):
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y wget
RUN apt-get cleanRIGHT (1 layer, cleanup actually saves space):
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
wget \
&& rm -rf /var/lib/apt/lists/*Use --no-install-recommends to skip suggested packages you don't need.
6. Run as Non-Root User
Default Docker containers run as root. Combined with a container escape vulnerability, this could compromise your host.
WRONG:
CMD ["node", "server.js"] # Runs as rootRIGHT:
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
COPY --chown=appuser:appgroup . .
USER appuser
CMD ["node", "server.js"]7. Always Include Health Checks
Without health checks, your orchestrator has no idea if your app is actually working vs stuck in a crash loop.
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1Key points:
--start-periodgives your app time to initialize- Check something meaningful (DB connectivity, not just "process exists")
- Keep checks lightweight (they run frequently)
8. Use Multi-Stage for Dev vs Prod
Don't ship debug tools, test suites, or dev dependencies to production.
# Base stage
FROM node:20.11-alpine AS base
WORKDIR /app
COPY package*.json ./
# Development stage (with dev tools)
FROM base AS development
RUN npm install
COPY . .
CMD ["npm", "run", "dev"]
# Builder stage
FROM base AS builder
RUN npm ci --only=production
COPY . .
RUN npm run build
# Production stage (minimal)
FROM node:20.11-alpine AS production
WORKDIR /app
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
USER appuser
EXPOSE 3000
CMD ["node", "dist/index.js"]Build with target: docker build --target production -t myapp:prod .
9. Scan Images Regularly
That base image from last year has known CVEs. Update deliberately, not never.
# Docker Scout
docker scout cves myapp:latest
# Trivy
trivy image myapp:latestSet up automated scanning in CI. Block deployments on critical vulnerabilities. Update base images monthly/quarterly with intentional testing.
10. Always Use .dockerignore
Without it, you're uploading your entire directory (including .git, node_modules, .env files) to the Docker daemon.
.git
node_modules
npm-debug.log
.env
.env.*
coverage
.nyc_output
*.md
.vscode
.idea
tests
__tests__Be aggressive. If it's not needed in the final image, exclude it.
When to Use
- User asks to "dockerize" a project or repository
- User needs a Dockerfile or compose.yml
- User wants to containerize their application
- User asks how to run their project in Docker
- User needs to set up a development environment image with Docker
- User needs to set up a product environment image with Docker
Analysis Workflow
Step 1: Analyze Repository Structure
To understand the project, examine these files and patterns:
Package/Dependency Files:
package.json,package-lock.json,yarn.lock,pnpm-lock.yaml(Node.js)requirements.txt,pyproject.toml,setup.py,Pipfile,poetry.lock(Python)go.mod,go.sum(Go)Cargo.toml,Cargo.lock(Rust)pom.xml,build.gradle,build.gradle.kts(Java/Kotlin)Gemfile,Gemfile.lock(Ruby)composer.json(PHP)*.csproj,*.fsproj,*.sln(C#/.NET)
Framework Detection Patterns:
- Next.js:
next.config.js,.next/directory,nextin dependencies - React:
reactin dependencies,src/App.jsxorsrc/App.tsx - Vue:
vue.config.js,vuein dependencies - Express:
expressin dependencies - FastAPI:
fastapiin requirements,uvicornusage - Django:
djangoin requirements,manage.py,settings.py - Flask:
flaskin requirements - Spring Boot:
spring-bootin pom.xml/build.gradle - Rails:
Gemfilewithrails,config/routes.rb
Database/Service Detection:
- PostgreSQL:
psycopg2,pg,postgresin dependencies or connection strings - MySQL:
mysql2,pymysql,mysql-connectorin dependencies - MongoDB:
mongoose,pymongo,mongodbin dependencies - Redis:
redis,ioredisin dependencies - Elasticsearch:
elasticsearch,@elastic/elasticsearchin dependencies - RabbitMQ:
amqplib,pikain dependencies - Kafka:
kafka-python,kafkajsin dependencies
Step 2: Determine Entry Points and Build Commands
Node.js Projects:
- Check
package.jsonscripts:start,dev,build,serve - Look for
mainormodulefields - Identify if it's a monorepo (workspaces, lerna, nx, turborepo)
Python Projects:
- Check for
main.py,app.py,run.py,manage.py - Look at
pyproject.toml[tool.poetry.scripts] or [project.scripts] - Check for ASGI/WSGI entry points (uvicorn, gunicorn configs)
Go Projects:
- Look for
main.goin root orcmd/directory - Check
go.modfor module name
Rust Projects:
- Check
Cargo.tomlfor [[bin]] targets - Look for
src/main.rs
Step 3: Generate Dockerfile
Follow these best practices when generating Dockerfiles:
- Use multi-stage builds to minimize image size
- Pin base image versions (e.g.,
node:20-alpinenotnode:latest) - Copy dependency files first to leverage layer caching
- Use non-root users for security
- Set appropriate WORKDIR
- Include health checks where applicable
- Use .dockerignore to exclude unnecessary files
Reference references/dockerfile-templates.md for language-specific templates.
BuildKit Best Practices
Leverage BuildKit features for faster builds and better security:
- Add syntax directive as the first line of every Dockerfile:
# syntax=docker/dockerfile:1 - Use cache mounts to speed up repeated builds:
- npm/yarn:
RUN --mount=type=cache,target=/root/.npm npm ci - pip:
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt - go mod:
RUN --mount=type=cache,target=/go/pkg/mod go mod download - cargo:
RUN --mount=type=cache,target=/usr/local/cargo/registry cargo build --release
- npm/yarn:
- Use secret mounts for private dependencies (avoids secrets in image layers):
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ci - BuildKit is enabled by default in Docker Engine v23.0+ and Docker Desktop
Step 4: Generate compose.yml
Include detected services with sensible defaults:
services:
app:
build: .
ports:
- "3000:3000" # Adjust based on detected port
environment:
- NODE_ENV=development
depends_on:
- db # If database detected
volumes:
- .:/app # For development hot-reload
- /app/node_modules # Prevent overwriting
# Add detected services belowService Configuration Defaults:
| Service | Image | Default Port | Volume |
| PostgreSQL | postgres:16-alpine | 5432 | postgres_data:/var/lib/postgresql/data |
| MySQL | mysql:8 | 3306 | mysql_data:/var/lib/mysql |
| MongoDB | mongo:7 | 27017 | mongo_data:/data/db |
| Redis | redis:7-alpine | 6379 | redis_data:/data |
| Elasticsearch | elasticsearch:8.11.0 | 9200 | es_data:/usr/share/elasticsearch/data |
Step 5: Generate Supporting Files
Always create .dockerignore:
node_modules/
__pycache__/
*.pyc
.git/
.env
.env.*
*.log
.DS_Store
Thumbs.db
dist/
build/
coverage/
.pytest_cache/
.mypy_cache/
target/For development, optionally create:
compose.ymlfor dev-specific settingscompose.prod.ymlfor production configuration
Output Format
When generating Docker configurations, provide:
- Analysis Summary: Brief overview of detected tech stack
- Dockerfile: With inline comments explaining key decisions
- compose.yml: Ready to run with
docker compose up - .dockerignore: Appropriate exclusions for the tech stack
- Usage Instructions: Commands to build and run
Example Usage Patterns
User says: "Dockerize this project"
- Run full analysis workflow
- Generate all configuration files
- Provide build/run instructions
User says: "Add Redis to my compose file"
- Read existing compose.yml
- Add Redis service with appropriate configuration
- Update app service with depends_on if needed
User says: "Optimize my Dockerfile"
- Read existing Dockerfile
- Suggest multi-stage build improvements
- Reduce image size
- Improve layer caching
Important Considerations
- Environment Variables: Never hardcode secrets. Use environment variables or Docker secrets
- Ports: Detect actual ports from code (look for .listen(), PORT env var usage)
- Health Checks: Add appropriate health check endpoints when detected
- Development vs Production: Generate configs suitable for development by default, with notes on production hardening
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

