Skip to content
ENExplore Calculators

Docker Layer Size Calculator

Break down how much each Dockerfile instruction adds to your final image layers.

About Docker Layer Size Calculator

Each Dockerfile instruction (RUN, COPY, ADD) creates a new read-only layer in the union filesystem. The total image size equals the base image plus all added layers. Identifying which layers contribute the most size helps optimize the Dockerfile by combining commands, using multi-stage builds, or choosing smaller base images.

Formula

Total Image Size

totalSize = baseImage + (numLayers × avgLayerSize)

baseImage
Base image size in MB
numLayers
Number of added layers
avgLayerSize
Average layer size in MB

Worked example

With the default values below, Docker Layer Size Calculator returns Total Image Size of 200.0. Change any input above and every figure here is recalculated in your browser.

Inputs used

Base Image Sizeaccepts 0–50,000 MB
80 MB
Number of Added Layersaccepts 1–500 layers
8 layers
Average Layer Sizeaccepts 0–10,000 MB
15 MB
Largest Layer Sizeaccepts 0–50,000 MB
120 MB

Results

Total Image Size
200.0 MB
Added Layers Total
120.0 MB
Largest Layer Share
60.0%
Base Image Share
40.0%

Step by step

  1. 1Added layers total= 120.0MB
  2. 2Total image size= 200.0MB
  3. 3Largest layer share= 60.0%

Assumptions and limits

  • The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 1 decimal place, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

How can I reduce the number of layers?

Chain multiple RUN commands with && to produce a single layer, and clean up temporary files within the same RUN instruction so deleted content never appears in a layer.

Does layer order affect final image size?

No — total size is the sum of all layers regardless of order. However, ordering affects cache invalidation: placing frequently-changing instructions last maximizes cache hits for earlier layers.

Docker Layer Size Calculator – Calculate Total Image Size