Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable/disable buildkit in docker?

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
like image 523
Code Eagle Avatar asked Mar 28 '21 07:03

Code Eagle


3 Answers

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:

  1. Open the file, on the command line the easiest way to do this is:
notepad "$env:USERPROFILE\.docker\daemon.json"
  1. Change the value of "buildkit" to false so it looks like this:
{
  "registry-mirrors": [],
  "insecure-registries": [],
  "debug": true,
  "experimental": false,
  "features": {
    "buildkit": false
  }
}
  1. 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:

Screenshot of Docker Desktop for Windows app

like image 90
tentative Avatar answered Oct 17 '22 14:10

tentative


For me restarting docker engine and system didnt work. But after I reset the factory settings it started working again. Go to Docker desktop troubleshoot options and reset to factory defaults.

like image 2
ANAND PUNNURI Avatar answered Oct 17 '22 14:10

ANAND PUNNURI


On Windows 10 x64 and Docker Desktop:

# Start DOS cmd prompt
set DOCKER_BUILDKIT=0
docker ...

No need to edit any files, restart service, etc. It just works as Docker checks the this environment variable when it runs.

Case study

Docker gave an error on the command line when I was logged into a remote PC using MobaXTerm on the command line. This fixed it.

like image 1
Contango Avatar answered Oct 17 '22 13:10

Contango