Skip to content

remorses/docker-phobia

Repository files navigation



docker-phobia

analyze Docker images and make them slim



Install

You can install docker-phobia with:

curl -sf https://goblin.run/github.com/remorses/docker-phobia | sh
# goblin.run will build the binary and place it in PATH
# if you have go installed you can also do
go install github.com/remorses/docker-phobia@latest

Usage

docker-phobia
# Use the arrow keys to navigate: ↓ ↑ → ←
# ? Select a Docker image:
#   ▸ node:18-slim
#     postgres:latest

# or pass the image tag as an argument
docker-phobia node:18-slim

Example Output

Every rectangle represents a folder or file in the image. The bigger the rectangle, the more space it takes up.

The different colors represent the different layers in the image. If two rectangles have the same color, they are in the same layer. If the color shade is similar, they are from layers close to each other.

example treemap

How it works

Execute docker-phobia to initiate a Go script that leverages dive internal API for Docker image retrieval and analysis, outputting a JSON file structure with file sizes. Concurrently, it spins up a server on port 8080 and launches docker-phobia.vercel.app, which visualizes the JSON data as a treemap.

Roadmap

  • Show the size for each rect on hover as tooltip
  • Use better domain
  • Use tags to version the cli
  • Add share button to share the treemap with anyone without installing again, use the image SHA in the url.
  • Automatically store public images (images from DockerHub with SHA already published) in a docker-phobia directory indexed on Google. People can see images size between versions and tags.