Docker for Windows 的 DOCKER_BUILDKIT?

Ric*_*ane 4 windows containers docker

我们正在尝试使用 DOCKER_BUILDKIT 访问 Docker 的一些实验性功能。我们看到这在 Mac 和 Linux 上运行良好,但不适用于 Windows。知道如何让它在 Windows 上工作吗?

BMi*_*tch 6

构建 Windows 映像的能力是buildkit 的一个已知限制。如果您对该功能感兴趣,可以订阅路线图上的此问题并为其投票:

https://github.com/microsoft/Windows-Containers/issues/34

Otherwise, for building Linux images, buildkit should work the same on Docker for Windows as it does on other environments, with either the DOCKER_BUILDKIT=1 environment variable for the feature flag set in the daemon.json file (configurable from the Docker preferences UI):

{ "features": { "buildkit": true } }
Run Code Online (Sandbox Code Playgroud)

Note that the environment variable overrides the feature flag on the engine. You can also use buildx which is another method to access buildkit. This has the same limitations as accessing buildkit directly (mainly you cannot build Windows images).


Yar*_*ham 4

它适用于我使用 Windows 版 Docker Desktop 版本

尝试将以下内容添加到您的 daemon.json 中:

"features": { "buildkit": true }
Run Code Online (Sandbox Code Playgroud)

  • 这是行不通的。在设置中设置 buildkit 在 Windows 中没有任何作用。我能够让 DOCKER_BUILDKIT 功能与打开实验设置一起工作。但这与在命令行上使用 DOCKER_BUILDKIT 或在设置中设置 { "buildkit": true } 相差甚远。 (3认同)