-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
docker-ce-17.06.0
I have a Dockerfile like this:
ARG REGISTRY_URL=machine:5000
ARG PI_VERSION=0.4
FROM ${REGISTRY_URL}/java:${PI_VERSION}
I cannot set REGISTRY_URL, neither by build-arg nor environment variable.
In jenkinsfile:
def dockerImage = docker.build "${VAR_DOCKER.registry}${item.name}:${item.versionDocker}"
Even with withEnv, it does not recognize new variable.
Your example code-line does appear to attempt to set the build-arg. It should have been something like
and then it will use the REGISTRY_URL value you set with withEnv.
Alternatively,
would not require you to export the override value into the shell environment with withEnv.
See docker build in the Docker Documentation for reference. Although the docs are for the current version, and this issue was lodged against a (now) 5-year-old Docker release, this behaviour shouldn't have changed.