containerizing-applications
Skill12 starsChanged 2 months agoMITView on GitHub
Containerizes applications with Docker, docker-compose, and Helm charts. Use when creating Dockerfiles, docker-compose configurations, or Helm charts for Kubernetes. Includes Docker Hardened Images (95% fewer CVEs), multi-stage builds, and 15+ battle-tested gotchas.
- Installs packages
2 other projects use a version of this.
Adopted by
Most recently taken up by
- AbdullahMalik17/Hacathan_5word for word, first seen Jan 31, 2026
- AbdullahMalik17/My_skillsword for word, first seen Jan 17, 2026
Other versions2 projects use a version of this.
Word for word · 2
- AbdullahMalik17/Hacathan_5★ 9100% same
- AbdullahMalik17/My_skills★ 9100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
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 repository60 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- browser-useSkill
- browsing-with-playwrightSkill
- building-chatgpt-appsSkill
- building-chat-interfacesSkill
- building-chat-widgetsSkill
- building-mcp-serversSkill
- building-nextjs-appsSkill
- building-rag-systemsSkill
- configuring-better-authSkill
- configuring-dapr-pubsubSkill
- context7-efficientSkill
- context-degradationSkill
- context-fundamentalsSkill
- context-optimizationSkill
- creating-skillsSkill
- deploying-cloud-k8sSkill
- deploying-kafka-k8sSkill
- deploying-postgres-k8sSkill
- designing-nextjs-uiSkill
- digital-fte-orchestratorSkill
- doc-coauthoringSkill
- docxSkill
- evaluationSkill
- fetching-library-docsSkill
- generating-ceo-briefingSkill
- installing-skill-trackerSkill
- internal-commsSkill
- managing-calendarSkill
- managing-odooSkill
- managing-servicesSkill
- memory-systemsSkill
- multi-agent-patternsSkill
- nextjs-devtoolsSkill
- nx-monorepoSkill
- operating-k8s-localSkill
- operating-production-servicesSkill
- pdfSkill
- posting-facebookSkill
- posting-instagramSkill
- posting-linkedinSkill
- posting-twitterSkill
- pptxSkill
- project-designerSkill
- researching-with-deepwikiSkill
- scaffolding-fastapi-daprSkill
- scaffolding-openai-agentsSkill
- sending-emailsSkill
- skill-creatorSkill
- streaming-llm-responsesSkill
- styling-with-shadcnSkill
- systematic-debuggingSkill
- theme-factorySkill
- tool-designSkill
- watching-filesystemSkill
- watching-gmailSkill
- watching-whatsappSkill
- working-with-documentsSkill
- working-with-spreadsheetsSkill
- xlsxSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Run impact analysis first (env vars, network topology, auth/CORS)
- Very specific: line 15
Create docker-compose.yml with proper networking
- Distinctive: line 195
Solution: Start postgres → Run Drizzle → Then start API
- Distinctive: line 209
Use Docker service names (api, web, sso) for server-side, NOT localhost
- Distinctive: line 212
Add Docker service names to trustedOrigins BEFORE building
- Very specific: line 215
Use depends_on with condition: service_healthy
- Very specific: line 218
Use start_period (e.g., 40s) for apps that take time to start
- Very specific: line 221
Use valid email like admin@example.com, not .local domains
- Distinctive: line 224
Keep test tools in devDependencies (300MB+ bloat)
- Very specific: line 227
Add separate /health endpoint via ASGI middleware
- Very specific: line 230
Use values file instead of --set for comma-containing values
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Containerizing Applications
Quick Start
- Run impact analysis first (env vars, network topology, auth/CORS)
- Generate Dockerfiles using patterns below
- Create docker-compose.yml with proper networking
- Package as Helm chart for Kubernetes
Dockerfile Patterns
FastAPI/Python (Multi-stage with uv)
# syntax=docker/dockerfile:1
FROM python:3.13-slim AS builder
WORKDIR /app
RUN pip install uv
COPY pyproject.toml .
RUN uv pip install --system --no-cache -r pyproject.toml
FROM python:3.13-slim
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
COPY . .
RUN useradd -u 1000 appuser && chown -R appuser /app
USER appuser
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]Next.js (Standalone)
# syntax=docker/dockerfile:1
FROM node:20-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci
FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ARG NEXT_PUBLIC_API_URL
ARG NEXT_PUBLIC_SSO_URL
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_SSO_URL=$NEXT_PUBLIC_SSO_URL
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]docker-compose Pattern
services:
web:
build:
context: ./web
args:
# BROWSER: baked into JS bundle
- NEXT_PUBLIC_API_URL=http://localhost:8000
environment:
# SERVER: read at runtime inside container
- SERVER_API_URL=http://api:8000
ports:
- "3000:3000"
depends_on:
api:
condition: service_healthy
api:
build: ./api
environment:
- DATABASE_URL=${DATABASE_URL}
- CORS_ORIGINS=http://localhost:3000,http://web:3000
ports:
- "8000:8000"
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40sHelm Chart Structure
helm/myapp/
├── Chart.yaml
├── values.yaml
├── templates/
│ ├── _helpers.tpl
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── configmap.yaml
│ ├── secret.yaml
│ └── ingress.yamlChart.yaml
apiVersion: v2
name: myapp
version: 1.0.0
appVersion: "1.0.0"values.yaml Pattern
api:
replicaCount: 1
image:
repository: myapp/api
tag: latest
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 8000
resources:
limits:
cpu: 500m
memory: 512MiHelm Commands
helm create mychart # Create new chart
helm template . --debug # Render templates
helm install myapp ./chart # Install
helm upgrade myapp ./chart # Upgrade
helm install myapp ./chart \
--set api.image.tag=v2.0.0 # Override valuesBattle-Tested Gotchas (15+)
1. Browser vs Server URLs
Problem: Browser runs on host, server runs in container
build:
args:
- NEXT_PUBLIC_API_URL=http://localhost:8000 # Browser
environment:
- SERVER_API_URL=http://api:8000 # Server2. Healthcheck IPv6 Issue
Problem: wget http://localhost:3000 fails with IPv6
healthcheck:
test: ["CMD", "wget", "--spider", "http://127.0.0.1:3000/"] # NOT localhost!3. MCP Server 421 Misdirected Request
Problem: FastMCP rejects Docker service names
transport_security = TransportSecuritySettings(
allowed_hosts=["127.0.0.1:*", "localhost:*", "mcp-server:*", "0.0.0.0:*"]
)4. SQLModel Tables Not Created
Problem: Models not imported before create_all()
# MUST import before create_all()
from .models import User, Task, Project # noqa: F401
SQLModel.metadata.create_all(engine)5. Database Migration Order
Problem: Drizzle db:push drops tables not in schema
Solution: Start postgres → Run Drizzle → Then start API
6. uv Network Timeout
RUN UV_HTTP_TIMEOUT=120 uv pip install --system --no-cache -r pyproject.toml7. Missing Syntax Directive
# syntax=docker/dockerfile:1 # ALWAYS first line
FROM python:3.13-slim8. localhost in Container
Use Docker service names (api, web, sso) for server-side, NOT localhost
9. Auth Origins
Add Docker service names to trustedOrigins BEFORE building
10. Service Startup Order
Use depends_on with condition: service_healthy
11. Health Check Timing
Use start_period (e.g., 40s) for apps that take time to start
12. pgAdmin Email Validation
Use valid email like admin@example.com, not .local domains
13. Playwright in Dependencies
Keep test tools in devDependencies (300MB+ bloat)
14. MCP Health Check 406
Add separate /health endpoint via ASGI middleware
15. Helm Comma Parsing
Use values file instead of --set for comma-containing values
Production Security
Docker Hardened Images (Recommended)
95% fewer CVEs than community images. Free under Apache 2.0.
# BEFORE: Community image with unknown CVEs
FROM python:3.12-slim
# AFTER: Docker Hardened Image
FROM docker.io/docker/python:3.12-dhiFive Pillars of DHI:
| Pillar | What You Get |
| Minimal Attack Surface | 98% CVE reduction |
| 100% Complete SBOM | SPDX/CycloneDX format |
| SLSA Build Level 3 | Verified provenance |
| OpenVEX | Machine-readable vuln status |
| Cosign Signatures | Cryptographic verification |
Verify signatures:
cosign verify docker.io/docker/python:3.12-dhiRead SBOM:
docker sbom docker.io/docker/python:3.12-dhiTrivy Scanning (CI/CD)
- name: Scan for vulnerabilities
run: trivy image --severity HIGH,CRITICAL --exit-code 1 ${{ env.IMAGE }}Distroless Images (Alternative)
# Python - use gcr.io/distroless/python3-debian12
FROM gcr.io/distroless/python3-debian12
# No shell, no package manager, runs as nonroot by defaultMulti-Arch Builds
- uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64 # Build for both
cache-from: type=gha
cache-to: type=gha,mode=maxBuildKit Secrets
# Mount secrets during build (never stored in layers)
RUN --mount=type=secret,id=npm_token \
NPM_TOKEN=$(cat /run/secrets/npm_token) npm installSee references/production-security.md for full patterns.
Verification
Run: python scripts/verify.py
Related Skills
operating-k8s-local- Local Kubernetes with Minikubedeploying-cloud-k8s- Cloud Kubernetes deploymentscaffolding-fastapi-dapr- FastAPI patterns
References
- references/production-security.md - Trivy, distroless, multi-arch, BuildKit secrets
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.

