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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How do you drain self-hosted Bitbucket runners?

I'd like to recycle and update my VMs that I use for my self-hosted Bitbucket runners on a regular basis. There's no time of day where I can be certain that the runners aren't doing some work on behalf of pipelines in Bitbucket.

That means I can't just blindly shut things down. I need to drain and restart them in a less interruptive way.

Is there a way to tell a docker-based runner to shut itself down after it finishes with whatever current task it happens to be processing?

1 answer

0 votes
Mark C Atlassian Team Apr 18, 2022

Hi @Ian Chesal

Welcome to the community.

Unfortunately, a Docker runners container is not gracefully shutting down at the moment.
In the same way, it is not possible to configure a runners' container to shut down itself after a task is done.
We do have an existing feature request for it to gracefully shutdown a Runners container that can be located through this link. -
You can upvote and watch it for now so that you'll be notified of any updates from our team when the feature becomes available on Bitbucket Cloud.
Please do note that we don't have an exact ETA for the feature request as all new features will be implemented according to our policy here.

As a workaround, as mentioned in the BCLOUD ticket as well, you can either:

  • Perform a manual stop on the container itself verifying there are no builds on the Pipelines UI; or,
  • With the use of Pipelines APIs, verify if there is a pipeline running on a particular repository and verify the status of the pipelines build and script to stop the runner container using `docker stop` command

You can check this link for the Pipelines API.

Do let me know if you have further questions.

Mark C

The API link is super helpful. Thank you!

Like Mark C likes this
Mark C Atlassian Team Apr 20, 2022

Great. Glad to know it helps.

Let me know if you have further questions that I can help with.
Otherwise, feel free to mark the question as answered.

Mark C

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events