> For the complete documentation index, see [llms.txt](https://camelgemonion.gitbook.io/docker/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://camelgemonion.gitbook.io/docker/dockerfile-zhi-ling/buildkit.md).

# BuildKit

构建工具

从版本**18.09**开始，**Docker**支持由**moby buildkit**项目提供的用于执行构建的新后端。与旧的实现相比，**BuildKit**后端提供了许多好处。例如，**BuildKit**可以：

* 检测并跳过执行未使用的构建阶段
* 并行构建独立构建阶段
* 两次构建之间仅增量传输构建上下文中的已更改文件
* 在构建上下文中检测并跳过传输未使用的文件
* 使用具有许多新功能的外部**Dockerfile**实现
* 避免其他**API**（中间镜像和容器）的副作用
* 优先考虑构建缓存以进行自动清&#x7406;**(prune)**

要使用**BuildKit**后端，您需要在调用**docker build**之前在**CLI**上设置环境变量**DOCKER\_BUILDKIT = 1**。

[**BuildKit repo**](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md)**.**
