| build | 按 build: 配置构建;指定服务则只构建该服务 |
|---|---|
| --no-cache | 跳过缓存全量重建 |
| --pull | 构建前强制拉取最新基础镜像 |
| pull | 只更新 image: 镜像(不涉及构建) |
| 并行 | 默认多用多构建并行进行 |
使用示例
使用示例
docker compose build --pull web
docker compose build --no-cache
docker compose pull db
docker compose up -d --build镜像 tag 写 latest 时 pull 结果不可预期:生产用固定版本 tag,升级动作显式可控。