docker
Skill4 starsChanged 59 days agoMITView on GitHub
Docker and containerization best practices: multi-stage builds, docker-compose, networking, volumes, security, and image optimization. Trigger: Docker, Dockerfile, docker-compose, container, image build, or containerization.
- Reads credentials
- Deletes or force-pushes
47 other projects use a version of this.
Adopted by
Most recently taken up by
- fmind/dottheir own version, first seen Oct 5, 2026
- Quad4-Software/skillstheir own version, first seen Oct 3, 2026
- fworks-tech/agenthoodtheir own version, first seen Sep 28, 2026
- iuliandita/skillstheir own version, first seen Sep 24, 2026
- nahid-sparktales/agent-dispatchertheir own version, first seen Sep 21, 2026
- jawwad-ali/claude-code-skillstheir own version, first seen Sep 5, 2026
Used with
Projects with it also use ansible, kubernetes and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
KubementatSkillansible
Ansible automation reference for playbooks, roles, inventory, variables, and modules. Includes Proxmox VE and Docker integration via community.general and community.docker collections. Use when writing playbooks, troubleshooting Ansible runs, or designing automation workflows. Triggers: ansible, playbook, inventory, role, task, handler, vars, jinja2, galaxy, proxmox_kvm, proxmox_lxc, docker_container, docker_compose.
Also in 3 projects that use this
mjunaidcaSkillkubernetes
Production-grade Kubernetes manifests and debugging for containerized applications. This skill should be used when users ask to deploy to Kubernetes, create K8s manifests, containerize for K8s, set up Deployments/Services/Jobs/StatefulSets/CronJobs, create namespaces with resource quotas, set up multi-team isolation, configure ResourceQuota/ LimitRange, secure with RBAC (ServiceAccount, Role, RoleBinding), configure init containers (model download, db wait, migrations), set up sidecars (logging, metrics), or debug pods (CrashLoopBackOff, logs, exec, describe, events). Auto-detects from Dockerfile/code, generates hardened manifests with educational comments. CKAD-aligned.
Also in 6 projects that use this
mjunaidcaSkillhelm
Production-grade Helm 4 chart development, release management, and debugging. This skill should be used when users ask to create Helm charts, deploy with Helm, manage releases (install/upgrade/rollback), push charts to OCI registries, debug failed deployments, configure chart dependencies, create umbrella charts, set up GitOps with ArgoCD/Flux, or troubleshoot Helm issues. Auto-detects from Dockerfile/code, generates production-hardened charts with library patterns. Complements kubernetes skill.
Also in 3 projects that use this
LangChainSkilllangchain
Build agents with a prebuilt architecture and integrations for any model or tool. Use when creating tool-calling agents, switching model providers, or adding structured output.
Also in 3 projects that use this
diego-tobalinaSkilllogging
Logging best practices for Java (SLF4J/Logback) and Node.js (Winston/Pino). Use for structured logging, log levels, and avoiding sensitive data exposure.
Also in 4 projects that use this
ihiteshguptaSkillterraform
Expert in Infrastructure as Code with Terraform. Use for creating, managing, and versioning infrastructure across cloud providers.
Also in 4 projects that use this
Other versions47 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 47
- codewithmukesh/dotnet-claude-kit★ 750same name
- nth5693/gemini-kit★ 373same name
- TheDecipherist/claude-code-mastery-project-starter-kit★ 338same name
- Mindrally/skills★ 266same name
- avibebuilder/claude-prime★ 120same name
- nahid-sparktales/agent-dispatcher★ 59same name
- kumaran-is/claude-code-onboarding★ 36same name
- neuron-one/GODMODE★ 33same name
- mjunaidca/mjs-agent-skills★ 27same name
- sordi-ai/skill-everything★ 20same name
37 more not listed
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 repository13 other files it gives its agents.
- api-designSkill
- changelog-maintenanceSkill
- create-readmeSkill
- database-designSkill
- git-commitSkill
- java-junitSkill
- java-springbootSkill
- java-springboot-testingSkill
- latexSkill
- ui-componentsSkill
- update-readmeSkill
- vault-tech-noteSkill
- web-mvcSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 42 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 49
Use layered JARs so dependency layers cache independently from application code.
- Very specific: line 136
Read-only root filesystem: --read-only --tmpfs /tmp
- Very specific: line 137
Use docker scout or trivy for vulnerability scanning
“Common” is measured: kept by at least 6 in 10 of the 42 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
When to Use
- Writing or reviewing a Dockerfile
- Setting up docker-compose for dev/test/prod
- Optimizing image size or build time
- Container security, networking, or volume management
- Dockerizing a Spring Boot application
Instructions
1. Multi-stage Builds for Spring Boot
# Stage 1: Build with Maven
FROM eclipse-temurin:21-jdk-alpine AS builder
WORKDIR /app
COPY pom.xml .
RUN mvn dependency:go-offline -B
COPY src src
RUN mvn package -DskipTests -B
# Stage 2: Extract layered JAR for cache efficiency
RUN java -Djarmode=layertools -jar target/app.jar extract --destination extracted
# Stage 3: Runtime
FROM eclipse-temurin:21-jre-alpine
RUN addgroup -S app && adduser -S app -G app
USER app
WORKDIR /app
COPY --from=builder /app/extracted/dependencies/ ./
COPY --from=builder /app/extracted/spring-boot-loader/ ./
COPY --from=builder /app/extracted/snapshot-dependencies/ ./
COPY --from=builder /app/extracted/application/ ./
EXPOSE 8080
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]Use layered JARs so dependency layers cache independently from application code.
2. Dockerfile Best Practices
| Practice | Why |
Use specific tags (21-jre-alpine, not latest) | Reproducible builds |
Prefer eclipse-temurin over openjdk | Actively maintained, security patched |
Run as non-root (USER app) | Security — container breakout mitigation |
Combine RUN commands | Reduce layers; apk add --no-cache && rm -rf /var/cache/apk/* |
Use COPY --chown=app:app | Avoid permission issues at runtime |
Set EXPOSE as documentation | Does not publish the port, just documents intent |
Use HEALTHCHECK | Let orchestrators know container state |
Prefer exec form (["java", "-jar"]) | Handles signals correctly (SIGTERM → graceful shutdown) |
3. docker-compose Patterns
Dev environment with services:
services:
app:
build: .
ports:
- "8080:8080"
environment:
SPRING_PROFILES_ACTIVE: dev
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/mydb
SPRING_DATASOURCE_USERNAME: app
SPRING_DATASOURCE_PASSWORD: ${DB_PASSWORD}
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
volumes:
- ./target:/app/target # hot reload in dev
db:
image: postgres:16-alpine
environment:
POSTGRES_DB: mydb
POSTGRES_USER: app
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app -d mydb"]
interval: 5s
timeout: 3s
retries: 5
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
pgdata:| Pattern | Usage |
depends_on + condition: service_healthy | Wait for DB to be ready before starting app |
.env file | Keep secrets out of compose files |
| Named volumes | Persist data across restarts (db, cache) |
Multi-stage Dockerfile | Dev builds fast, prod is slim |
| Profile-specific overrides | docker-compose -f compose.yml -f compose.dev.yml |
4. Decision Table
| Need | Approach |
| Local dev with hot reload | docker compose watch or spring-boot-devtools with volume mount |
| CI build | Multi-stage with --cache-from |
| Production deploy | Slim runtime image, non-root, read-only root fs |
| Database in tests | Testcontainers (not docker-compose in tests) |
| Multiple microservices | docker compose with shared network |
| Kubernetes | Use the same image, add liveness/readiness probes |
5. Security
- Never hardcode secrets in Dockerfile or compose — use secrets mounts or env files
USER nonroot— alwaysCOPY --chown=nonroot:nonroot— match the runtime user- Read-only root filesystem:
--read-only --tmpfs /tmp - Use
docker scoutortrivyfor vulnerability scanning - No
curl/wgetin runtime image — reduces attack surface
Commands
# Build with cache from registry
docker build --cache-from myapp:latest -t myapp:latest .
# Run with compose for dev
docker compose up -d
# Watch for hot reload (Docker Compose v2.22+)
docker compose watch
# Scan image for vulnerabilities
docker scout quick myapp:latest
# Run with read-only root fs
docker run --read-only --tmpfs /tmp myapp:latestResources
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.

