We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker BuildKit 是 Docker 18.09 版本中引入的一项构建优化特性。启用 BuildKit 可以带来一系列构建性能和功能上的提升,如更好的缓存管理、并行构建步骤执行、构建步骤的按需执行,以及避免发送不必要的上下文到 daemon 等。
为了使用 Docker BuildKit,您需要在构建 Docker 镜像时设置环境变量 DOCKER_BUILDKIT=1。例如,在命令行中构建 Docker 镜像时可以这样设置:
sh DOCKER_BUILDKIT=1 docker build .
或者,可以在 Docker 配置文件中(通常是 /etc/docker/daemon.json 或 ~/.docker/config.json 文件)设置 BuildKit 为默认构建器:
json { "features": { "buildkit": true } }
使用 BuildKit 的优势包括:
不过,请注意,因为 BuildKit 还在持续开发中,某些旧版本的 Docker 或平台可能还不支持 BuildKit 的全部特性。在移动旧的构建流程到 BuildKit 的时候,需要确保测试其兼容性。这样可以确保旧流程不会由于新构建过程中的差异而出现问题。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Docker BuildKit 是 Docker 18.09 版本中引入的一项构建优化特性。启用 BuildKit 可以带来一系列构建性能和功能上的提升,如更好的缓存管理、并行构建步骤执行、构建步骤的按需执行,以及避免发送不必要的上下文到 daemon 等。
为了使用 Docker BuildKit,您需要在构建 Docker 镜像时设置环境变量 DOCKER_BUILDKIT=1。例如,在命令行中构建 Docker 镜像时可以这样设置:
sh
DOCKER_BUILDKIT=1 docker build .
或者,可以在 Docker 配置文件中(通常是 /etc/docker/daemon.json 或 ~/.docker/config.json 文件)设置 BuildKit 为默认构建器:
json
{
"features": {
"buildkit": true
}
}
使用 BuildKit 的优势包括:
不过,请注意,因为 BuildKit 还在持续开发中,某些旧版本的 Docker 或平台可能还不支持 BuildKit 的全部特性。在移动旧的构建流程到 BuildKit 的时候,需要确保测试其兼容性。这样可以确保旧流程不会由于新构建过程中的差异而出现问题。
The text was updated successfully, but these errors were encountered: