# How could i build a container to do automatic rolling updates

**URL:** <https://forums.suse.com/t/how-could-i-build-a-container-to-do-automatic-rolling-updates/2164>\
**Category:** Rancher 1.x\
**Created:** [March 25, 2016, 2:57pm UTC](https://forums.suse.com/t/how-could-i-build-a-container-to-do-automatic-rolling-updates/2164 "2016-03-25T14:57:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcowden](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dcowden](https://forums.suse.com/u/dcowden)\
**Post date:** [March 25, 2016, 2:57pm UTC](https://forums.suse.com/t/how-could-i-build-a-container-to-do-automatic-rolling-updates/2164/1 "2016-03-25T14:57:23Z")

</div>

I would like to build a container that runs on rancher, and automatically performs rolling updates when there are changes to an image, similar to how watchtower works: [https://github.com/CenturyLinkLabs/watchtower](https://github.com/CenturyLinkLabs/watchtower)

We cannot use watchtower because it doesn’t perform rolling ( no downtime ) updates like rancher-compose can.

What we’d like to do is to combine the ‘watch for updates’ feature with rancher-compose upgrade, so that when a new version of a container is ready, its is rolled into production.

I’ve searched around and I have not found something like this. We are happy to build it and contribute it back as a community catalog, but I need some help figuring out how to integrate it with rancher.

I know i can use the metadata service to get info on all of the images, which i could use to contact our registry to see if there is a new version.

But I do not know how i could then trigger a rolling update for that service. It seems like the rolling functionality is all built into the rancher-compose binary, not an api that I can call.

What’s my best strategy to proceed?

---

<div class="post-metadata">

**Author:** ![etlweather](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/etlweather/32/419_2.png) [@etlweather](https://forums.suse.com/u/etlweather)\
**Post date:** [March 25, 2016, 6:48pm UTC](https://forums.suse.com/t/how-could-i-build-a-container-to-do-automatic-rolling-updates/2164/2 "2016-03-25T18:48:47Z")

</div>

@dcowden - I wrote a small Python program which I use in a similar way to cause zero-downtime upgrade of my services.

> **[etlweather/gaucho](https://github.com/etlweather/gaucho)**
>
> gaucho - A Python CLI tool for Rancher's API

In my case, I have a GitLab web hook receiver ([https://github.com/olipo186/Git-Auto-Deploy](https://github.com/olipo186/Git-Auto-Deploy)) which when called, runs the program to upgrade the service (my changes are not based on container updates).

So you could find/make a receiver for the Docker Repository events (supposing that this is the trigger point for you) which runs the program I wrote to cause a service upgrade through the API.

---

<div class="post-metadata">

**Author:** ![dcowden](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@dcowden](https://forums.suse.com/u/dcowden)\
**Post date:** [March 25, 2016, 7:12pm UTC](https://forums.suse.com/t/how-could-i-build-a-container-to-do-automatic-rolling-updates/2164/3 "2016-03-25T19:12:49Z")

</div>

Aces! I had a look at your code, that’s just what i need!  
I just need to replace this with code to poll my registry for changes, and then make a docker container out of it. When i get something working, i’ll let you know.

This seems like a very useful container to have in the rancher catalog!

---

<div class="post-metadata">

**Author:** ![etlweather](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/etlweather/32/419_2.png) [@etlweather](https://forums.suse.com/u/etlweather)\
**Post date:** [March 25, 2016, 11:21pm UTC](https://forums.suse.com/t/how-could-i-build-a-container-to-do-automatic-rolling-updates/2164/4 "2016-03-25T23:21:30Z")

</div>

@dcowden - Glad it’s useful to someone else!
