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

Task not pulling Docker image on each build

wsams March 5, 2020

Hi, I have a task that's using a Docker container to perform a deployment.

Under the "Docker" tab of the job I've selected "Docker container"

I've provided an image, and for this example let's say the tag is "stable". The tag doesn't change for this job.

In the Task I have a Script step. The "Interpreter" is "Shell". The "Script location" is "File". The "Script file" is "/". And I'm passing some values in "Argument".

The problem I'm facing is when I build a new image and push to our registry, this job doesn't pull the latest image.

I can make it pull if I create a new tag and set that in the "Docker" tab, but ideally the tag would remain the same. We want clients to use our "stable" tag for their builds and we continually build and push to that image.

Is there a way to ensure the Docker image is pulled before every run? Do I need to add another "Docker pull" task? I think that would work, but was hoping not to have to add another task.


1 answer

0 votes
shanishalgi July 29, 2020

We have the same issue.

This is what works for me: I created another plan with a shell script that pulls the docker image I need. I schedule this plan to run daily. The latest docker is then updated in the cache.

wsams July 29, 2020

Will that pull the image on all of the bamboo agents, or just the one where the shell script was executed?

shanishalgi July 29, 2020

I'm not sure what you mean. You can try and check to see  what happens.

See this  reference for pulling docker images:

wsams July 30, 2020

Our Bamboo instance has multiple agents (separate machines that do the work for a plan). I'm pretty sure we've ruled out that option (separate job/plan to pull the image) because the shell script will be run on one of the agents. On that agent the Docker image would be pulled correctly. But not on all agents. So when our job that uses the Docker image runs, there's no guarantee it will run on the agent with the updated image.

Our administrators could set up a cron job and have that image pulled on every agent, but we'd prefer a checkbox on the job to indicate the agent should pull the image every time the job runs.

We've also pondered having a separate stage to pull the image, but stages within a plan aren't guaranteed to run on the same agent.

For now we've decided to tag each image release. We created a global Bamboo variable with the tag name and update it when we have a release. Each of the jobs that use this image use that variable to set the tag. That's been working and ensures the image is pulled every time the tag changes. It just requires one small manual step per release.

shanishalgi July 30, 2020

It's a shame that Bamboo doesn't support this simple feature.
Maybe in the future

Like wsams likes this

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events