It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Dockerfile throws error for env variable

Hi All,

Thanks for creating such a wonderful tool for automations.

Am currently working on a project where I need to create Docker task to build and push the image to a nexus repo.

 

Here is my sample docker file (Specify the Dockerfile contents in the tasks)

# Base
FROM openjdk:8-jdk-alpine
# Add App
RUN mkdir -p /app/config
EXPOSE 8080/tcp
EXPOSE 10389/tcp

 

The above works perfectly fine.

 

Now I wanted to push some values into this docker file to make it more generic.

So I defined under variable of that same bamboo tasks a key value pair given below.

key=BASEIMAGE

value=openjdk:8-jdk-alpine

 

and changed my dockerfile to below: (Specify the Dockerfile contents i nthe tasks):

# Base
FROM ${bamboo.BASEIMAGE}
# Add App
RUN mkdir -p /app/config
EXPOSE 8080/tcp
EXPOSE 10389/tcp

 

The above works perfectly fine too and swap the ${bamboo.BASEIMAGE} to "openjdk:8-jdk-alpine"

 

The issue appears when I save the same Dockerfile to a git repo and try to use the option "Use an existing Dockerfile located in the task's working directory" to pull the dockerfile while creating the docker build image from th erepo.

The same dockerfile throws error.

 

Error:

Sending build context to Docker daemon  23.06MB
build	11-Feb-2020 13:06:31	
build	11-Feb-2020 13:06:31	Step 1/4 : FROM ${bamboo.BASEIMAGE}
error	11-Feb-2020 13:06:31	failed to process "${bamboo.BASEIMAGE}": missing ':' in substitution

I am not sure why it is throwing error. As the dockerfile is not changed at all or is there a different way to get the env variables into Dockerfile using repo

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Unable to add or edit Bitbucket Cloud repository in Bamboo

On 31 May, a GDPR-related change went live in the Bitbucket Cloud API that resulted in users not being able to create or edit Bitbucket Cloud Linked repositories in Bamboo. This API update removed t...

1,417 views 2 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you