dive for optimizing docker image

Use dive as a tool for optimizing and exploring a Docker image, layer contents, and discovering ways to shrink the size of your Docker or OCI image

Installation Instructions on Mac Machine

  • Install using brew:
brew install dive

Examples of running dive for optimizing Docker images

  • Running dive as part of CI pipeline with arguments to fail/pass the build. For example, the below will fail the build if wasted bytes is more than 1024 bytes:
dive --ci --highestWastedBytes 1024 30a68f3b058e
using dive as a tool for optimizing Docker/OCI image
Figure A – Example of using dive for optimizing Docker/OCI image
  • Other key features of the tool are:
    • Ability to show Docker image content by each layer
    • Ability to indicate change in each layer
    • Ability to estimate Docker image efficiency
    • Ability to integrate with continous integration (CI) tool
    • Ability to inspect multiple images sources and container engines

This technology tip to use dive as a tool for optimizing Docker or OCI image can be used not only for build time but also for runtime integration with CI (continuous integration) tool as a build quality parameter.


Read blogs on our website for various focus areas

Software Architecture and Design Patterns

Emerging Technology Patterns & Trends

Technology Learnings and Knowledge Sharing

Leave a Comment