spec:
output:
to:
kind: "ImageStreamTag"
name: "sample-image:latest"
使用 docker 或 source-to-image (S2I) 策略的构建会创建一个新的容器镜像。然后将该镜像推送到`Build`规范的`output`部分中指定的容器镜像注册表。
如果输出类型是`ImageStreamTag`,则该镜像将被推送到集成的 OpenShift 镜像注册表并在指定的镜像流中进行标记。如果输出类型是`DockerImage`,则输出引用的名称将用作 docker push 规范。该规范可能包含一个注册表,如果没有指定注册表,则默认为 DockerHub。如果构建规范的 output 部分为空,则在构建结束时不会推送镜像。
spec:
output:
to:
kind: "ImageStreamTag"
name: "sample-image:latest"
spec:
output:
to:
kind: "DockerImage"
name: "my-registry.mycompany.com:5000/myimages/myimage:tag"
docker 和 source-to-image (S2I) 策略构建会在输出镜像上设置以下环境变量
变量 | 描述 |
---|---|
|
构建的名称 |
|
构建的命名空间 |
|
构建的源 URL |
|
构建中使用的 Git 引用 |
|
构建中使用的源提交 |
此外,任何用户定义的环境变量(例如,使用 S2I 或 docker 策略选项配置的环境变量)也将成为输出镜像环境变量列表的一部分。
docker 和 source-to-image (S2I) 策略构建会在输出镜像上设置以下标签
标签 | 描述 |
---|---|
|
构建中使用的源提交的作者 |
|
构建中使用的源提交的日期 |
|
构建中使用的源提交的哈希值 |
|
构建中使用的源提交的消息 |
|
源中指定的 branch 或引用 |
|
构建的源 URL |
您还可以使用`BuildConfig.spec.output.imageLabels`字段来指定将应用于根据构建配置构建的每个镜像的自定义标签列表。
spec:
output:
to:
kind: "ImageStreamTag"
name: "my-image:latest"
imageLabels:
- name: "vendor"
value: "MyCompany"
- name: "authoritative-source-url"
value: "registry.mycompany.com"