Docker Layer Visualizer

Visualize the layers in your Docker image to understand their size and impact on the overall image. Identify opportunities for optimization.

Dockerfile
Docker History JSON
Docker Image
We'll analyze your Dockerfile instructions to simulate layer creation.
Run docker history --format '{{json .}}' your-image | jq -s '.' and paste the output below
📁
Drag and drop a Docker image tarball or click to browse
Export your image with docker save -o image.tar your-image
Note: Your Docker image is processed locally in your browser. No data is sent to our servers.

Layer Analysis

7
Total Layers
142 MB
Total Size
15 MB
Wasted Space
85%
Efficiency Score
Layer Stack
Size Treemap
Detailed Table
Layer 7
CMD ["npm", "start"]
~0 MB
Layer 6
EXPOSE 3000
~0 MB
Layer 5
COPY . .
7 MB
Layer 4
RUN npm install
85 MB
Layer 3
COPY package*.json ./
1.2 MB
Layer 2
WORKDIR /app
~0 MB
Layer 1 (Base)
FROM node:14-alpine
50 MB
RUN npm install (85 MB) Base Image (50 MB) COPY (7 MB) Other (1.2 MB)
# Instruction Size Cumulative Notes
1 FROM node:14-alpine 50 MB 50 MB Base image
2 WORKDIR /app ~0 MB 50 MB Metadata only
3 COPY package*.json ./ 1.2 MB 51.2 MB Partially overwritten by Layer 5
4 RUN npm install 85 MB 136.2 MB Largest layer (59.8% of total)
5 COPY . . 7 MB 143.2 MB Includes source code
6 EXPOSE 3000 ~0 MB 143.2 MB Metadata only
7 CMD ["npm", "start"] ~0 MB 143.2 MB Metadata only

Optimization Recommendations

  • High Impact Optimize the npm install layer

    Your npm install layer (85 MB) accounts for nearly 60% of the image size. Consider using `npm ci --production` to avoid installing dev dependencies in your final image.

  • Medium Impact Implement multi-stage builds

    Use a larger image for building and a smaller image for runtime. This could reduce your final image size by up to 40%.

  • Low Impact Reduce wasted space in package.json

    Layer 3 (COPY package*.json) is partially overwritten by Layer 5 (COPY .). Consider using a .dockerignore file to exclude unnecessary files.

Want to Learn More About Docker Layer Optimization?

Check out our tutorials on optimizing Docker images, including multi-stage builds, layer optimization, and caching strategies.

Browse Tutorials