Passing environment variables to docker from GitLab CI/CD job failing

Published

I am having issues passing variables which are defined in the GitLab ci file to my docker file
My GitLab CI file looks like this

variables:
  IMAGE             : "openjdk"
  IMAGE_TAG         : "11-slim"

docker-image:
  extends: .build
  variables:
    DOCKER_IMAGE_VERSION  : ${JDK_IMAGE}:${JDK_IMAGE_TAG}

My Docker file looks a bit like this:

# --- STAGE 1 ----------------------------------------------------------------
# Getting ARGS for build
ARG DOCKER_IMAGE_VERSION

# Start with a base image containing Java runtime
FROM ${DOCKER_IMAGE_VERSION} as build

Now i am getting the following error when the pipeline starts the docker build:

Step 1/7 : ARG DOCKER_IMAGE_VERSION
Step 2/7 : FROM ${DOCKER_IMAGE_VERSION} as build
base name (${DOCKER_IMAGE_VERSION}) should not be blank

Can someone help point me where i am going wrong?
Thanks

Source: Dockerfile Questions

Published
Categorised as dockerfile, gitlab-ci Tagged ,

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq