Release v1.5.0: Restructure chapters and update for Docker v30.x

This commit is contained in:
Baohua Yang
2026-02-04 22:12:38 -08:00
parent bdd5366ced
commit 2264a7ae72
304 changed files with 1314 additions and 364 deletions

39
08_buildx/buildx.md Normal file
View File

@@ -0,0 +1,39 @@
# 使用 Buildx 构建镜像
## 使用
你可以直接使用 `docker buildx build` 命令构建镜像
```bash
$ docker buildx build .
[+] Building 8.4s (23/32)
=> ...
```
Buildx 使用 [BuildKit 引擎](buildkit.md) 进行构建支持许多新的功能具体参考 [Buildkit](buildkit.md) 一节
### 使用 `bake`
`docker buildx bake` 是一个高级构建命令支持从 HCLJSON Compose 文件中定义构建目标实现复杂的流水线构建
```bash
# 从 docker-compose.yml 构建所有服务
$ docker buildx bake
# 仅构建指定目标
$ docker buildx bake web
```
### 生成 SBOM
Buildx 支持在构建时直接生成 SBOM (Software Bill of Materials)这对于软件供应链安全至关重要
```bash
$ docker buildx build --sbom=true -t myimage .
```
该命令会在构建结果中包含 SPDX CycloneDX 格式的 SBOM 数据
## 官方文档
* https://docs.docker.com/engine/reference/commandline/buildx/