Skip to content

Dive

A tool to explore docker images by layer

github project

Examine image layer contents

One useful functionality of this tool is to examine the contents of each layer. For example, it revealed python bytecode (*.pyc) files in the image that were taking up as much space as the python packages. That prompted some research to eliminate the bytecode files to significantly reduce the image size.

Here are the steps to recreate that view

  1. Start the tool

    dive hackforlaops/mkdocs:testing
    
  2. Move to the relevant layer using the arrow keys

  3. Press Tab to switch to layer view (moves cursor to the right pane)

  4. Press Ctrl+U to hide unmodified files in the layer

  5. Press Ctrl+O to sort by size to see what's taking up the most space

  6. Press Space to toggle collapse/expand directory contents