Works with the AI Agents you already use
Docker Image Size Analyzer and Reducer
by Saizul Amin
This skill gives your agent a proven procedure plus scripts that check the facts, so you get the same correct answer every time, with exact fixes instead of vague advice.
$5
Docker Image Size Analyzer and Reducer
Example session with this skill installed
Run the Docker Image Size Analyzer and Reducer skill on my project and give me a prioritised list of what to fix, with exact changes.
- Read your context and instructions
- Compiled the docker image size
Here is what the Docker Image Size Analyzer and Reducer skill produced.
Demo: real, unedited output of the skill's bundled script on a sample input from its test suite.
Output
image: 1.2GB in 9 layers (4 metadata-only), source: docker-history
heaviest layers:
#6 412.0MB 35.5% RUN chown -R node:node /app
#5 298.0MB 25.6% RUN npm install
#3 221.0MB 19.0% RUN apt-get update && apt-get install -y python3 make g++
#0 117.0MB 10.1% ADD file:a1b2c3d4e5f6 in /
#4 114.0MB 9.8% COPY . /app
suggestions:
HIGH budget.exceeded (image, 1.2GB): image is 1.2GB, over the budget of 300.0MB.
HIGH chown.duplicate (layer #6, 412.0MB): recursive chown/chmod rewrites every file into a new layer (size counted twice); use COPY --chown / COPY --chmod instead.
MEDIUM node_modules.layer (layer #5, 298.0MB): node_modules layer: install production deps only (npm ci --omit=dev) in the runtime stage, or copy a pruned node_modules from a build stage.
MEDIUM apt.layer (layer #3, 221.0MB): apt layer: add --no-install-recommends, remove apt/lists/* in the same RUN, and move compilers (build-essential, gcc) to a build stage.
MEDIUM build.in-runtime (layer #3, 221.0MB): build step in the final image: move it to a build stage and COPY --from only the binary/artifacts.
MEDIUM copy.context (layer #4, 114.0MB): large COPY of the build context: check .dockerignore (node_modules, .git, build output, data files) and copy only what the runtime needs.
MEDIUM rm.separate-layer (layer #7, 0B): files deleted in a later layer still ship in the earlier one; delete them in the same RUN that creates them, or use a multi-stage build.
What you do next
- Fix the highest-severity items first.
- Ask your agent to apply the fixes it suggests, then run the skill again to confirm.
- Keep the skill installed and re-run it whenever the project changes.
Connects securely to your tools. The creator never sees your data.
About this skill
Find out why a container image is big and how to shrink it. A script parses docker history --no-trunc --format json or dive --json output, ranks the heaviest layers with percentages, detects recursive chown/chmod layers that duplicate files, apt/apk/pip/npm layers without cleanup, large COPY of the build context, build tools left in the runtime image, files deleted in a later layer (still shipped), dive's wasted bytes and duplicated files, oversized base images, and can enforce a size budget in CI. Includes a base image comparison (slim, alpine, distroless, chiseled, scratch).
Who it's for
Use when the user asks why their Docker image is so large, wants to reduce image size, compares two image versions, sees slow pulls or deploys, or wants an image size budget check in CI.
What's inside
- Tested, offline Python script(s): analyze_layers.py (deterministic results, standard library only unless noted)
- Reference guides: base-images.md
- Step-by-step agent instructions in SKILL.md covering: When to use; When not to use; Workflow; CI usage
Why it's worth it
Generic prompts guess. This skill gives your agent a proven procedure plus scripts that check the facts, so you get the same correct answer every time, with exact fixes instead of vague advice. See the real demo below.
Works with every major AI agent
Built on the open SKILL.md standard: Claude Code, Codex CLI, Cursor, VS Code Copilot, Gemini CLI, Windsurf and 20+ other agents.
Requirements
- Python 3.8+ for the bundled scripts
- No API keys, no account, runs locally
Open source: saizul/docker-container-skills on GitHub (MIT licence, by Saizul Amin).
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 days ago
- Software
Python 3.8+