| image | 镜像名与标签 |
|---|---|
| build | context / dockerfile / args / target |
| 共存 | 构建结果按 image 命名 |
示例
示例
services:
api:
build:
context: ./api
dockerfile: Dockerfile
args:
VERSION: "1.4.2"
image: registry.example.com/team/app/api:1.4.2多阶段构建可用 target 指定构建阶段;args 里的值不要放密钥,构建参数会进镜像元数据。