Docker Image Cache

The Docker Image Cache (DIC) is a great way to speed up the build process of deployments. This feature is enabled by default for new repositories.

Squash generates a cache snapshot for each unique Dockerfile/docker-compose file across all branches in a repository. This is done by keeping a md5sum reference of each Dockerfile/docker-compose file. When a Dockerfile or docker-compose file changes Squash will build it from scratch and save a new cache snapshot.

A DIC snapshot is only created when a deployment build process is successfully completed and when Squash encounters a success status after starting docker run or docker-compose up.

Invalidating the cache

Dockerfile update

Besides the md5sum, Squash also keeps a reference of the branch where the Dockerfile/docker-compose file was generated for the first time (origin branch). Squash automatically updates the cache and deletes the previous version when the Dockerfile changes in the origin branch.

Another easy way to update the cache is to change the Dockerfile/docker-compose file on any branch within the repository. Squash in this case will create a new cache snapshot and use the branch as its origin branch.

API update

See our Docker Image Cache API for more details.

How to enable or turn off the cache

Step 1

Go to the Squash Admin page and then click on Settings -> Repositories

../_images/customizing-assets.png

Step 2

Click on the checkbox “Cache Docker Images”.

This setting is enabled by default for new repositories.

../_images/docker-img-cache-enable.png

Cache retrieval notification

Squash provides information on several areas on when a DIC snapshot is being used or not.

Deployment Loading page

When you start a new deployment Squash will display on the sidebar whether or not a DIC snapshot is available and being used:

../_images/dic-loading.png

Deployment Details page

Same for the deployment details page:

../_images/dic-vm-detail.png

Historical Deployments page

The historical page also display this information:

../_images/dic-historical.png