fqih/.mycc-setup/docker-patterns
Claude Code and agent skill by fqih/.mycc-setup
- community
Checking that the SKILL.md file is still in the repository.
Use when writing Dockerfiles, docker-compose, containerization — multi-stage builds, layer caching, security, image size optimization, health checks, networks, volumes. For Avo sandbox + general. Trigger on "dockerfile", "docker-compose", "container", "image", "build context", "/docker-check".
Install
npx vskill@latest install fqih/.mycc-setup/docker-patternsSKILL.md
The same SKILL.md was published earlier as fqih/.mycc-setup/docker-patterns.
docker-patterns
Docker best practices untuk production + development. Fokus pada image kecil, aman, cepat build.
Dockerfile template (Python)
Size comparison:
python:3.12(full) → 1.2GBpython:3.12-slim→ 150MBpython:3.12-alpine→ 50MB (butuh musl, kadang kompatibilitas issue)- Multi-stage slim → 200-300MB total (dengan deps)
Layer caching rules
Order by change frequency (jarang berubah → sering berubah):
- Base image
- System packages
- Language deps (requirements.txt, package.json)
- Source code
- Config files
Multi-stage builds
Docker Compose patterns
Local dev (hot reload)
Production
Networking
Default: bridge network, services dapat DNS name = service name.
Volumes vs bind mounts
| Type | Use | |
|---|---|---|
| Named volume | DB data, persistent state | |
| Bind mount | Source code (dev), config files | |
| tmpfs | Secrets, cache, sensitive data | |
| Anonymous volume | Protect from bind mount (e.g., /app/node_modules) |
Security checklist
- [ ] Non-root user di runtime stage
- [ ]
--no-install-recommendsuntuk apt - [ ]
rm -rf /var/lib/apt/lists/*setelah apt - [ ]
--no-cache-diruntuk pip - [ ] No secrets di image (pakai env atau secret mount)
- [ ] Pin base image version (jangan
latest) - [ ]
.dockerignoreexclude.git,node_modules,.env,*.md, tests - [ ] Scan image:
trivy,grype,snyk - [ ] Read-only filesystem + writable volume untuk data dirs
- [ ] Drop capabilities:
cap_drop: [ALL],security_opt: [no-new-privileges] - [ ] Resource limits (CPU, memory)
.dockerignore
Image optimization
ROCm (AMD GPU) di container
Lihat skill local-ml-gpu untuk GPU workflow.
Health checks
Status: healthy, unhealthy, starting (during start-period).
Logging
Networking debugging
Common pitfalls
| Pitfall | Solusi | |
|---|---|---|
| Image 2GB+ | Multi-stage, slim base, clean cache | |
| Build ulang tiap code change | Layer cache order benar | |
| Container run as root | Add USER di Dockerfile | |
| Container restart on crash | restart: unless-stopped | |
| DB data hilang saat recreate | Named volume, jangan tmpfs | |
| Hot reload tidak jalan di container | Bind mount source + ignore node_modules via anonymous vol | |
| Network isolation broken | Custom networks, jangan pakai network_mode: host | |
| Secrets di env di-commit | Docker secrets atau external secret manager | |
| Build context besar | .dockerignore exclude junk | |
| ENTRYPOINT vs CMD confusion | ENTRYPOINT = main binary, CMD = default args |
For Avo sandbox specifically
Lihat src/avo/app_tools/sandbox.py reference. Pattern untuk AI agent:
Runtime:
--network=none(no external network)--read-onlyfilesystem + tmpfs untuk /tmp--memory,--cpuslimits--cap-drop=ALL--security-opt=no-new-privileges
Invokation
Auto-trigger saat:
- Edit
Dockerfile*,docker-compose*.yml,.dockerignore - User sebut "docker", "container", "image", "deploy container"
- Code pattern:
docker build,docker compose,docker run
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/docker-patterns/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/fqih/.mycc-setup/docker-patterns)