Squashing a Docker Image strictly using Bash

Docker images can get big and they sometimes are so large that they become hard to manage. As a result of this you may find yourself needing to decrease this size by removing the layers and that’s where this utility I wrote comes in handy.

Basically what it does is Export the Raw Container File System, Import the Raw File System, Create a new Docker Image from that Raw File System, and Exports/Imports the freshly built Image.

These steps are ELABORATE but unfortunately necessary due to the unfortunate lack of functionality in some of the Docker Squash utilities.

If you find yourself at wits end and have tried all the other Docker Squash tools try the one below I’ve written in Bash.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s