Docker Squash

1.2.2 · active · verified Thu Apr 16

docker-squash is a Python utility that reduces Docker image sizes by combining multiple layers into one. It retains Dockerfile metadata such as `PORT` and `ENV` instructions, which the native `docker build --squash` command often discards. The project is actively maintained with regular updates, currently at version 1.2.2.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to pull a base Ubuntu image and then use `docker-squash` to squash its layers into a new image tagged `ubuntu:squashed`. The final command lists Docker images, allowing you to compare the original and squashed image sizes.

docker pull ubuntu:latest
docker-squash -t ubuntu:squashed ubuntu:latest
docker images | grep 'ubuntu'

view raw JSON →