Open SamStenton opened 2 years ago
The last one is inconsistent with Docker, too, isn't it?
ARG DOCKERFILE_NODE_BUILD_IMAGE_NAME=node
ARG DOCKERFILE_NODE_BUILD_IMAGE_VERSION=alpine
ARG DOCKERFILE_NGINX_IMAGE_NAME=nginx
ARG DOCKERFILE_NGINX_IMAGE_VERSION=alpine
FROM ${DOCKERFILE_NODE_BUILD_IMAGE_NAME}:${DOCKERFILE_NODE_BUILD_IMAGE_VERSION} as node
FROM ${DOCKERFILE_NGINX_IMAGE_NAME}:${DOCKERFILE_NGINX_IMAGE_VERSION} as nginx
In Docker the substitutions in the second FROM
wouldn't work unless the ARG
lines were repeated after the first FROM
, because all ARG
s are cleared after each FROM
. https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
Actual behavior When making use of ARGs in a docker file with a default value, the variable default isn't evaluated if defined after a 'FROM' instruction.
Expected behavior Default variables to be evaluated no matter where they're put.
To Reproduce Steps to reproduce the behavior:
This doesn't work
This does work when passing
--build-arg DOCKERFILE_NGINX_IMAGE_NAME=otherimage --build-arg DOCKERFILE_NGINX_IMAGE_VERSION=otherversion
This also works without needing to use
--build-arg
Additional Information
Image: gcr.io/kaniko-project/executor:debug
Triage Notes for the Maintainers
--cache
flag