How to enable/disable buildkit in docker?
Mar 28
I got this command from the documentation, but i really have no idea how can I use it or where should I start to move, I'm new to docker, and concepts are still hard to me to digest:
$ DOCKER_BUILDKIT=1 docker build .
How can I use this command to enable/disable buildkit in docker engine??
I want to disable it, because as i knew it is enabled by default and i suspect it as i can't build anything by docker since i get always this error
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount847288160/Dockerfile: no such file or directory
1 answer
Accepted answer · original discussion
Mar 28
You must adjust the Docker Engine's daemon settings, stored in the daemon.json, and restart the engine. As @Zeitounator suggests, you should be able to temporarily disable the buildkit with DOCKER_BUILDKIT=0 docker build .. Docker CLI will parse that environment variable and should honor it as that checking is done here in the docker/cli source code.
To adjust the Docker daemon's buildkit settings, you can follow the instructions below.
From these docs. Partially on the command line, you can do that this way in Powershell:
- Open the file, on the command line the easiest way to do this is:
notepad "$env:USERPROFILE\.docker\daemon.json"
- Change the value of
"buildkit"tofalseso it looks like this:
{
"registry-mirrors": [],
"insecure-registries": [],
"debug": true,
"experimental": false,
"features": {
"buildkit": false
}
}
- Restart the Docker service:
Restart-Service *docker*
Alternatively, on Docker Desktop for Windows app:
Open the Dashboard > Settings:
Select Docker Engine and edit the json "features" field to read false if it's not already:
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
Mar 28
DOCKER_BUILDKIT=0 docker build . but it is not reported in the documentation and I am not sure that the docker command line will honor it.