build
build配置选项用于构建时(build time)。
build可以使用包含路径的字符串来指定构建上下文:
version: "3.8"
services:
webapp:
build: ./dir
也可以使用对象表示法:
version: "3.8"
services:
webapp:
build:
context: ./dir
dockerfile: Dockerfile-alternate
args:
buildno: 1
如果指定了build和image字段,Compose会将构建的镜像命名为image字段里面指定的值以及一个可选的tag。
build: ./dir
image: webapp:tag
Last updated
Was this helpful?