SlimImage: Slashing Container Size by Up to 95% While Hardening Production Cloud Infrastructure
Description and use
SlimImage reduces container size to 38 MB, removes all CVEs, and cuts pull time to 0.3 s, improving resilience and lowering network costs.
Problem
Container images are often bloated with unnecessary tools, libraries, and binaries, causing slow pull times, high storage and egress costs, and large attack surfaces.
Outcome
SlimImage cuts image size by up to 96 %, removes all CVEs, and reduces cold pull time from several seconds to sub‑second, improving autoscaling latency and lowering network costs.
Workflow
- Build the original image with Docker
- Run
slimimage build --target <image> --tag <image>:slim --probe-http-get /healthz --probe-exec "python -c 'import app; print(\"Synthesized\")'" --preserve-ca-certs --generate-sbom - Verify size reduction with
docker images --format "table {{.Repository}} {{.Tag}} {{.Size}}" - Scan both images with Trivy to confirm CVE count
- Integrate the command into CI/CD (e.g., GitHub Actions) to harden every build
Evidence
Standard Node.js Image (~1.1 GB) … SlimImage Optimized Artifact (~38 MB)
Node.js (v20 Bullseye) 1,080 MB → 42 MB, 96.1% reduction, 0 CVEs, ~0.35s pull vs 8.9s
trivy image my-service:latest | grep -E "Total: [0-9]+" # Total: 78 ... trivy image my-service:slim | grep -E "Total: [0-9]+" # Total: 0
- Record date: 2026-10-15T10:41:31.023Z