How to use Bamboo variables when using an existing Dockerfile in a Docker build task

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

    

Purpose

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
--build-arg VERSION=${bamboo.versionVariable}
Dockerfile
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



Last modified on Jan 6, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.