根据 dockerfile 中的条件更改基础映像
Change base image based on condition in dockerfile
我想将参数 USE_ALPINE 发送到 docker 文件
如果是真的,我将使用高山图像
如果它是假的,我将使用 debian image
USE_ALPINE 的默认值我想将其设置为 false。
利用combination of ARG and FROM in Dockerfile.
您可以在 FROM 语句中使用在 ARG 中声明的变量。
ARG APP_IMAGE=alpine:latest
FROM ${APP_IMAGE}
CMD /path/to/mycode
也可以使用 --build-arg option of docker build command 覆盖此值。
docker build -t myapp:v1 --build-arg APP_IMAGE=busybox:latest .
我想将参数 USE_ALPINE 发送到 docker 文件 如果是真的,我将使用高山图像 如果它是假的,我将使用 debian image
USE_ALPINE 的默认值我想将其设置为 false。
利用combination of ARG and FROM in Dockerfile.
您可以在 FROM 语句中使用在 ARG 中声明的变量。
ARG APP_IMAGE=alpine:latest
FROM ${APP_IMAGE}
CMD /path/to/mycode
也可以使用 --build-arg option of docker build command 覆盖此值。
docker build -t myapp:v1 --build-arg APP_IMAGE=busybox:latest .