如何在 docker 中启用/禁用 buildkit? [英] How to enable/disable buildkit in docker?

查看:49
本文介绍了如何在 docker 中启用/禁用 buildkit?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从文档中得到了这个命令,但我真的不知道如何使用它或我应该从哪里开始移动,我是 docker 新手,而且概念对我来说仍然难以消化:

$ DOCKER_BUILDKIT=1 docker build .

如何使用此命令在 docker 引擎中启用/禁用 buildkit??

我想禁用它,因为我知道默认情况下它是启用的,我怀疑它是因为我无法通过 docker 构建任何东西,因为我总是遇到此错误

failed to solve with frontend dockerfile.v0: failed to read dockerfile: open/var/lib/docker/tmp/buildkit-mount847288160/Dockerfile: no such file or directory

解决方案

您必须调整存储在 daemon.json 中的 Docker 引擎的守护程序设置,然后重新启动引擎.正如@Zeitounator 所建议的那样,您应该能够使用 DOCKER_BUILDKIT=0 docker build . 暂时禁用 buildkit.Docker CLI 将解析该环境变量,并在检查完成时应遵守它

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

解决方案

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:

这篇关于如何在 docker 中启用/禁用 buildkit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆