DevTools Logo

Docker Image Layer Visualizer

Docker Image Layer Visualizer

Paste docker history output to see layer sizes, a treemap and bloat hints.

Runs in your browser
5 layers · 26.9MB total · 6.1MB estimated waste
Try an example

Docker history output

6 lines · 560 chars

Layer breakdown

4 finding(s)
/bin/sh -c #(nop) CMD ["node"]0B · base
/bin/sh -c apt-get update && apt-get install -y24.5MB · base
/bin/sh -c #(nop) COPY dir:abc in /app1.2MB
/bin/sh -c #(nop) COPY dir:abc in /app1.2MB
/bin/sh -c echo done4kB
5 layers · 26.9MB total
Base image: 24.5MB · Findings: 4 · Estimated waste: 6.1MB

Details

Built images are stacks of read-only layers, and a single careless RUN instruction can hide tens of megabytes in a package-manager cache. Paste the output of docker history --no-trunc (or --format json) to see each layer's command, size and share of the image. A rule engine flags classic bloat patterns such as unremoved apt caches, repeated COPY instructions and zero-byte metadata layers. Nothing is uploaded: parsing and rendering happen in this tab.

More examples

Uncleaned package cache

<missing>  /bin/sh -c apt-get update && apt-get install -y curl  24.5MB

The layer is flagged with an estimated 20% wasted bytes because /var/lib/apt/lists is not removed in the same layer.

Duplicate COPY

COPY dir:abc in /app  1.2MB
COPY dir:abc in /app  1.2MB

The second COPY is reported as a duplicate; combine the files into one layer to avoid shipping content twice.

Base image layers

<missing>  /bin/sh -c #(nop) CMD ["node"]  0B

<missing> marks a layer inherited from a pulled base image; it is badged as base in the stack.

Examples

Package cache

Input
/bin/sh -c apt-get update && apt-get install -y curl — 24.5MB
Output
apt-cache finding · estimated waste 4.9MB

Deleting /var/lib/apt/lists in the same RUN instruction avoids keeping the index in the layer.

Repeated COPY

Input
COPY dir:abc in /app — 1.2MB (twice)
Output
duplicate-copy finding on the second layer

Identical COPY destinations in separate layers ship the same content twice.

Metadata-only layer

Input
#(nop) LABEL version=1 — 0B
Output
metadata-layer + zero-size findings

Such layers are normal but can be hidden so the stack focuses on real byte usage.

Base layers

Input
<missing> — CMD ["node"] — 0B
Output
Layer badged as base

Layers inherited from the pulled base image cannot be fixed in your own Dockerfile.

About this tool

Docker Image Layer Visualizer turns the unreadable table from docker history into a layer stack, a size treemap and a short list of bloat findings. Paste the table (or JSON from --format json) and each layer's command, size and share of the image appears immediately.

The parser understands B, kB, MB and GB sizes, joins backslash-continued commands, accepts Windows line endings and marks <missing> image IDs as inherited base layers. Lines with unknown size units are skipped and counted, so a malformed paste never silently produces a misleading total.

A small rule engine flags classic bloat: package caches left behind by apt/yum/dnf, repeated COPY commands and zero-byte metadata layers. Wasted bytes are estimates based on common patterns, not a byte-level diff of the image. All parsing happens locally; no image data is uploaded.

What this tool does not do

  • Only docker history text or JSON is analyzed; the image filesystem is never inspected.
  • Wasted-bytes hints are heuristic estimates, not measured deltas.
  • Multi-architecture manifest images are treated as a single history; there is no per-platform split.
  • Rows with size units outside B/kB/MB/GB are skipped and reported rather than guessed.
  • No Docker daemon or binary is required or used.

How to use this tool

  1. Get the history

    Run docker history --no-trunc <image> and copy the whole table, or use docker history --format json for structured input.

  2. Paste and inspect

    Paste into the input pane. The stack shows each command and size as a proportional bar; the base badge marks inherited layers.

  3. Read the findings

    Switch to Findings for bloat hints and Treemap for a size-proportional view. Zero-byte layers can be hidden.

  4. Copy the summary

    Copy or download the text summary to attach it to a ticket or a build-size discussion.

Use cases

Shrinking deploy images

See which layer dominates an oversized image before rewriting a Dockerfile.

CI size regressions

Paste history from two builds and compare which layer grew.

Learning layering

Show learners how each Dockerfile instruction becomes a layer with its own size.

Ticket evidence

Copy a text summary of the stack and findings into a performance ticket.

Accepted input and units

InputHandling
docker history tableColumns detected from the header row; commands may span continuation lines
--format jsonArray of objects with ID, CreatedBy, Size and Comment keys
SizesB, kB, MB and GB (powers of 1024); decimals accepted
<missing> IDsBadged as base/pulled layers
Unknown unitsRow skipped and counted in the warning banner
CRLF / LFBoth accepted

The image itself is never uploaded or inspected — only the text you paste.

Common mistakes

Mistake:Expecting the tool to detect deleted files still stored in lower layers.

Fix:It only sees docker history output; use dive or image diff tools for filesystem-level analysis.

Mistake:Treating waste estimates as exact byte counts.

Fix:The heuristics flag common patterns; verify with an actual image rebuild before quoting savings.

Mistake:Pasting truncated docker history output.

Fix:Use --no-trunc so commands are complete; continuation lines with a trailing backslash are joined.

Mistake:Assuming <missing> layers are broken.

Fix:That marker means the layer came from a pulled base image, not that the image is invalid.

Mistake:Hiding zero-byte layers and thinking they were removed.

Fix:The toggle only affects the view; the underlying image is unchanged.

Frequently asked questions

How do I get the history output?

Run docker history --no-trunc <image> in a terminal and paste the whole table. For structured input, docker history --format json also works. The --no-trunc flag prevents commands from being cut off.

Why do some layers say <missing>?

Docker uses <missing> as the image ID for layers inherited from a pulled base image. The badge means base layer, not error. Those layers cannot be optimized from your own Dockerfile.

Can it detect deleted files still present in lower layers?

No. This tool sees only the command and size columns from docker history. Detecting files that still occupy lower layers requires a filesystem-level tool such as dive.

Does the image upload anywhere?

No. Parsing, analysis and rendering run in your browser tab. Nothing is sent to a server, and the pasted history is not persisted between visits.

How accurate are the wasted-bytes hints?

They are heuristic estimates: for example, roughly 20% of a layer with an uncleaned apt cache, or the full size of a duplicate COPY. Use them as pointers for investigation, then verify by rebuilding the image.

Why was a line skipped?

The parser needs a recognizable size in B, kB, MB or GB. Rows with unknown units or too few columns are skipped and counted in the warning banner so the total stays trustworthy.

References & standards