Docker

How to Resolve “–squash is only supported on Docker daemon with experimental features enabled” Docker Error

Docker is a well-established and widely used tool for DevOps project development. It builds and deploys projects with the help of different components, and Docker images are one of them. The Docker image contains instructions to run the containers for deploying projects.

To create a Docker image with a minimum size “docker build –squash” command is utilized. But sometimes, when the developer runs the mentioned command to build an image, the “–squash is only supported on Docker daemon with experimental features enabled” error occurs.

In this blog, we will demonstrate how to resolve the –squash is only supported on Docker daemon with experimental features enabled error.

How to Resolve “–squash is Only Supported on Docker Daemon with Experimental Features Enabled” Docker Error?

The Docker daemon is a major component of Docker that is used to listen to Docker API and manage the Docker component, such as Docker images, containers, registries, and so on. When the experiment feature of Docker is disabled, the Docker daemon does not allow the squashing of the Docker layers for building a Docker image with minimum size. Therefore, when users try to run the “docker build –squash” command, the specified error occurs, as shown below:

Fix: Enable Experimental Features of Docker Daemon

To resolve the specified error, go through the provided instructions.

Step 1: Open Docker Application
First, launch the Docker Desktop application from the Start menu:

Step 2: Go to Docker Settings
Next, visit the Docker settings by hitting the “Gear” icon:

Step 3: Enable Experimental Feature
Open the “Docker Engine” settings under the Docker settings. From the below output, you can notice that the Docker Daemon “experimental” feature is set as “false”, which means the experimental feature is currently disabled:

To resolve the specified error, the users are required to enable the experimental feature. For this purpose, set the value of “experimental” as “true”. Then, hit the “Apply & restart” button to save changes:

Now, open your favorite terminal and execute the “docker build –squash” command to verify whether the error is resolved or not:

$ docker build --squash -t demo .

Here, you can see that we have successfully resolved the specified error:

We have elaborated on how to resolve the “–squash is one supported on Docker daemon with experimental features enabled” Docker error.

Conclusion

To resolve the mentioned Docker error, first, open the Docker Desktop application and navigate to its settings. From the Docker settings, visit the “Docker Engine” settings. After that, enable the “experimental” feature by setting its value as “true”. This post has demonstrated how to resolve the “–squash is one supported on Docker daemon with experimental features enabled” Docker error.

About the author

Rafia Zafar

I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.