mirror of
https://github.com/yeasy/docker_practice.git
synced 2025-08-07 15:52:22 +00:00
33
buildx/buildx.md
Normal file
33
buildx/buildx.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# 使用 Buildx 构建镜像
|
||||
|
||||
## 启用 Buildx
|
||||
|
||||
`buildx` 命令属于实验特性,必须设置环境变量以使用该命令。
|
||||
|
||||
Linux/macOS
|
||||
|
||||
```bash
|
||||
$ export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
```
|
||||
|
||||
Windows
|
||||
|
||||
```bash
|
||||
$ set $env:DOCKER_CLI_EXPERIMENTAL=enabled
|
||||
```
|
||||
|
||||
## 使用
|
||||
|
||||
你可以直接使用 `docker buildx build` 命令构建镜像。
|
||||
|
||||
```bash
|
||||
$ docker buildx build .
|
||||
[+] Building 8.4s (23/32)
|
||||
=> ...
|
||||
```
|
||||
|
||||
Buildx 使用 [BuildKit 引擎](buildkit.md) 进行构建,支持许多新的功能,具体参考 [Buildkit](buildkit.md) 一节。
|
||||
|
||||
## 官方文档
|
||||
|
||||
* https://docs.docker.com/engine/reference/commandline/buildx/
|
Reference in New Issue
Block a user