Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Is it possile to use environment variables as image name for bitbucket pipelines?


I was trying to set docker image name in `bitbucket-pipelines.yml` as a value of environment variable. Unfortunately, both ways I've tried failed:

image: $IMAGE_NAME



If I replace $IMAGE_NAME with actual value - everything works fine. 

Could you please tell me if there is a way to perform it?

Thank you,

7 answers

1 accepted

7 votes
Answer accepted

I have the same problem, seems like image name accepts only hardcoded values.

would be awesome. I just stumpled upon this issue. removed all hardcoded values from my pipeline definition and added them to team-variables so they can be changed easily without having to change bitbucket-pipeline.yml in all repositories. for everything else it works so far, just image cant be substituted.

Like Igor Bodnar likes this

I have the same issue.

It throws this error when using environment variables: There is a problem with the format of your docker image name at [image > name].

But if you goto the online validator it says it's syntactically valid with the environment variable.

My use case is that I'd like to define my AWS account id and region as environment variables so that the pipeline script is more portable between my local test BB account and the "real" repo.

The problem with the validator is that it only checks the YAML syntax. Seeing as an image name should be a string, and either `my-image:latest` or `$MY_IMAGE` is considered a string, the validator checks out. However as you already understand it doesn't interpolate variables on that specific location.

Like Antonius Golly likes this
16 votes
Alex Tran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 16, 2019

Would love to have this feature supported !

I also hope to get this one day. We regularly upgrade gradle version in and in Jenkins we have the first step extracting gradle version from this file and then uses it for the next step so we don't need to touch pipeline file every time we upgrade gradle.

How is this still not supported after almost 3 years?

So many use cases for this functionality! Please vote for this Feature Request:

Like Elgiz Abbasov likes this

Hoping to get this feature.

Been waiting for 5 years now

Vote on it please!

I have the same issue with image name, but also with max-time. For the latter, it says that value should be integer and got string. 

0 votes
Danyal Iqbal
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jun 01, 2018

Where did you set the variable?

I set it in team variables also tried local project variables.

I can confirm that this isn't supported. I've tried several ways of defining the variable but all failed. Repository specific or team wide account variables aren't supported in the image name.

I'd love to see support for this!

Like # people like this

"I'd love to see support for this!" yes, please :)

Like Igor Bodnar likes this

I would also like to see this feature. How else can you use an image that has been built with a tag based on the BITBUCKET_BUILD_NUMBER?

Like # people like this

This would be a great feature. Would love to get this support.

Like Igor Bodnar likes this

That would be very handy

Like Igor Bodnar likes this

+1. Without this feature, this is not possible to declare the google container registry path dynamically for example

Like Richie likes this

it would be very useful

Like Ramila Herath likes this

would be very handy 

@David Worthington I too build an image at runtime and need to execute it. In my case a cypress test runner image. Since the step image doesnt support variables I use docker run in the script section. 

Hard to believe so basic features are not supported. I'm stating to use bb cloud for a few weeks and I'm terrrified how unmature it is comparing to GitLab.

It will reduce the need to commit pipeline files when we need the pipeline to use  a different image (say node or Python upgrade cases)

I've also voted. Would be great feature to have

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events