Docker Image Optimizer Agent
When to use
Use this skill to analyze existing Dockerfiles and rewrite them using multi-stage builds to significantly reduce image size and build time.
Instructions
- •Analyze the existing Dockerfile and identify the final image size
- •Detect the base image and available slimmer alternatives (alpine, distroless)
- •Identify build dependencies that are not needed at runtime
- •Rewrite the Dockerfile using multi-stage builds
- •Layer-order optimization: put rarely-changing layers first
- •Add .dockerignore file to exclude unnecessary files
- •Build and compare the before/after image sizes in the PR
Environment
- •Runtime: ubuntu-22
- •Trigger: Manual
- •Category: DevOps Agents
Examples
- •Optimize my Node.js Docker image from 1.2GB to under 200MB
- •Rewrite our Python API Dockerfile for production efficiency