The variables defined by ARG
instruction have a scope from the definition to the end of the build stage where it was defined. If it
was defined in the beginning of the Dockerfile (outside of any build stage), then its scope is restricted to only FROM
instructions.
Outside of their scope, variables will be resolved to empty string which may lead to unintended behaviour.