Docker Runner doesn't pull the latest image automatically

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

The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.

You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.

We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!

Docker Runner doesn't download newer versions of the image automatically.

Environment

Bamboo build and deployment jobs configured to run inside Docker container using Docker Runner.

Diagnosis

When running build or deployment jobs in Docker containers using Docker Runner, if a new version of the image being used is available, it doesn't get downloaded before the jobs run. This can cause jobs to fail if new features have been added to the image and are required for the new workflow to succeed.

Cause

Bamboo uses a cached image on the build agent. If Docker finds the tag locally, it won't check the remote registry for an updated version of the same tag.

This is related to the following feature request to change this behavior: BAM-21047 - Pull Image for Docker Runner

Solution

Workaround 1

Setup a cron job that will periodically pull the image on the remote agents.

Workaround 2

Use a versioned tag rather than the latest tag for the image. It would still need to be updated in Bamboo whenever a new version is available, but you could use a Global Variable for that, so you only have to update one place. For example:

  1. Create a Global Variable:

    1 2 Name: busyboxTag Value: uclibc (this is one of the tags for the Busybox Docker image)
  2. At the job's Docker tab, set it to use the following image: busybox:${bamboo.busyboxTag}

  3. Let's say a newer version of the image was made available, tagged "unstable". All you have to do is update thebusyboxTagGlobal Variable value to unstable, and the next build will download it automatically before running the container:

1 2 3 4 5 6 7 8 9 command 18-May-2022 14:27:56 Substituting variable: ${bamboo.busyboxTag} with unstable [...] error 18-May-2022 14:27:57 Unable to find image 'busybox:unstable' locally error 18-May-2022 14:28:00 unstable: Pulling from library/busybox error 18-May-2022 14:28:01 5f3b81648a12: Pulling fs layer error 18-May-2022 14:28:02 5f3b81648a12: Download complete error 18-May-2022 14:28:02 5f3b81648a12: Pull complete error 18-May-2022 14:28:02 Digest: sha256:0d1d11dbad88f301fe745cf1b3fca8ee44ff5cf1c1be721f36b22bec592d9966 error 18-May-2022 14:28:02 Status: Downloaded newer image for busybox:unstable

This will automatically apply to all build plans that are set to use that image and variable, so you won't have to edit all of them manually or run the docker pull on each agent.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.