What Layerlens does

Layerlens is a static Dockerfile analyzer. It parses a Dockerfile into its instruction stream, maps each instruction to the layer it produces, and models Docker's build cache without ever running docker build. The result is a visual layer stack that shows the relative weight of each layer, which layers rebuild when you change a source file, and a ranked list of concrete fixes. Everything runs in your browser on the text you paste, so it is safe for private and proprietary Dockerfiles.

How to use it

  1. Paste your Dockerfile into the editor on the left, or load one of the examples.
  2. Read the two headline numbers: the relative image weight, and the percent of that weight that rebuilds on a routine source edit. A high rebuild percentage means your cache is working against you.
  3. Hover a layer to see the cache cascade: every layer downstream that the change would invalidate lights up. This is how you spot the one instruction that busts an expensive install.
  4. Apply the ranked suggestions. Each names the exact line and the change to make, such as copying your package.json before running npm ci.

Frequently asked questions

Does Layerlens run my Docker build or upload my Dockerfile?
No. It never runs docker build and needs no daemon. All parsing and analysis happen locally in your browser on the text you paste, so nothing leaves your machine.
Why does my dependency install rebuild on every code change?
Almost always because a broad COPY . . sits above the install. Docker keys each layer on the ones before it, so copying your whole source first invalidates the install layer on any file change. Copy only the dependency manifest first, run the install, then copy the rest.
Are the sizes real megabytes?
No. Real byte sizes require an actual build. Layerlens reports honest relative weights inferred from instruction semantics: package installs and broad copies dominate, metadata instructions weigh almost nothing. The numbers are meaningful next to each other, not as absolute sizes.
Does it understand multi-stage builds?
Yes. It tracks FROM ... AS stage boundaries and COPY --from= edges, so a change in a build stage cascades into every stage that copies from it.
What does it check for?
Dependency installs placed after a broad copy, apt installs that never clean their package lists, order-sensitive heavy installs, ADD used where COPY is safer, floating :latest base images, and broad copies missing a .dockerignore.