How to use Bamboo variables when using an existing Dockerfile in a Docker build task
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When using a Docker task in Bamboo to build a docker image, it may be desirable to pass and dereference Bamboo variables even when using an existing Dockerfile.
Solution
Use Docker build arguments:
It can be configured in Bamboo inside your Docker task configuration using the Additional Arguments field. Example below:
Additional Arguments
1
--build-arg VERSION=${bamboo.versionVariable}
Dockerfile
1
2
ARG VERSION
RUN curl -L --silent https://packages.atlassian.com/maven-external/com/atlassian/bamboo/atlassian-bamboo/${VERSION}/atlassian-bamboo-${VERSION}.pom > /tmp/pom.xml
Was this helpful?