Search code examples
dockerbuilddockerfilearguments

Docker image build fails to recognize build argument : invalid reference format


I'm building a docker file and the it fails at the first line.

FROM artifactory.company.com/local-docker-repo/dockerimage/docker-batch-base:$VERSION

I pass the build arguments this way

docker image build --build-arg VERSION=latest -q -t artifactory.company.com/local-docker-repo/batch/batch-run-sst:1.0-SNAPSHOT .

But it throws an error saying invalid reference format

Step 1/5 : FROM artifactory.company.com/local-docker-repo/dockerimage/docker-batch-base:$VERSION
invalid reference format

What am I missing here


Solution

  • I had to declare ARG VERSION in the docker file before using it. Thanks @Ali Tou