Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/vivek-viswanat/dev-arsenal/docker-image-optimizer-devopsnpx skills add vivek-viswanat/dev-arsenal --skill docker-image-optimizer-devopsgit clone --depth 1 https://github.com/vivek-viswanat/dev-arsenalWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/vivek-viswanat/dev-arsenal/docker-image-optimizer-devops)<a href="https://agentmods.dev/skills/vivek-viswanat/dev-arsenal/docker-image-optimizer-devops"><img src="https://agentmods.dev/badge/skills/vivek-viswanat/dev-arsenal/docker-image-optimizer-devops.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00027 | $0.00525 |
| Opus 5 | $0.00014 | $0.00262 |
| Sonnet 5 | $0.00005 | $0.00105 |
| Haiku 4.5 | $0.00003 | $0.00052 |
Grade B, and why
Docker Image Optimizer Devops scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletemediumDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
*Example:* `RUN apt-get update && apt-get install -y --no-install-recommends pkg && rm -rf /var/lib/apt/lists/*` Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.
What it actually says
Context
Use this skill when:
- Creating a new
Dockerfile - A user complains about "slow builds" or "large images"
- Reviewing container security (reducing attack surface)
Optimization Pillars
1. Multi-Stage Strategy (The 2026 Standard)
- Separate Build from Runtime: Use a heavy image (with compilers/SDKs) for building, but copy ONLY the final binary/artifacts into a minimal runtime image (Alpine or Scratch).
- Named Stages: Use
FROM base AS builderfor readability.
2. Base Image Selection
- Prefer Minimal: Default to
alpine(≈5MB) ordebian-slim(≈30MB) overubuntu:latest(≈75MB). - Distroless: For production, suggest
gcr.io/distrolessto remove all shells and package managers.
3. Layer Management & Caching
- Order Matters: Place instructions that change least often (like
RUN apt-get update) at the top. Place source codeCOPYcommands at the bottom. - Atomic RUNs: Combine related commands using
&&and\to prevent intermediate layer bloat. Example:RUN apt-get update && apt-get install -y --no-install-recommends pkg && rm -rf /var/lib/apt/lists/*
4. Dependency Hygiene
- No-Install-Recommends: Always use
--no-install-recommendswithapt. - Cache Cleaning: Remove package manager caches in the same layer as the installation.
- Production Only: Ensure
devDependenciesor build-only headers never reach the final stage.
5. The .dockerignore File
- Exclusion: Every Docker project MUST have a
.dockerignoreto prevent.git,node_modules,tests/, and local logs from leaking into the build context.
Instructions for the Agent
- When a user provides a Dockerfile, perform a Size Audit first.
- If the image is single-stage, provide a Refactored Multi-Stage Version.
- Check for "Magic Versions" and suggest pinning specific tags (e.g.,
node:22.1.0-alpineinstead ofnode:latest).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 38 lines · 27 tokens per session scan B ae04a43aa25f
Docker Image Optimizer Devops is a skill published in the GitHub repository vivek-viswanat/dev-arsenal (4 stars, last pushed 5mo ago), licensed MIT. It adds 27 tokens to every session and 525 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
incident-commander
Autonomous incident detection, root-cause analysis, and self-healing for Linux/Docker production environments. Activate when the user mentions: server down, high CPU, memory leak, disk full, service crash, deployment failure, alert firing, on-call page, or any infrastructure emergency. Also activates on scheduled…
k8s-deploy
Deploy and manage applications on Kubernetes clusters with kubectl and Helm.
docker-homelab
Deploy and manage docker compose services in a self-hosted homelab.
docker-management
Docker container lifecycle management, Dockerfile authoring, and debugging.
docker-essentials
Essential Docker commands for container and image management.
docker-essentials-1-0-0
Docker容器与镜像管理必备命令.