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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Task not pulling Docker image on each build

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 "/deploy.sh". 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.

Thanks

1 answer

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.

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

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

See this  reference for pulling docker images:
https://docs.docker.com/engine/reference/commandline/image_pull/

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.

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
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center is here!

G’day Bamboo customers, The wait is over! Bamboo Data Center edition you have been asking for is finally here! This self-managed enterprise offering of Bamboo has the resilience, reliability, and s...

538 views 1 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you