Watchtower: Incremental tags and semver

Created on 31 Jul 2018  Â·  9Comments  Â·  Source: containrrr/watchtower

When pushing a new docker image, we tag it using SemVer i.e

My/Image:1.0.0
My/Image:1.1.0-alpha01
My/Image:1.1.0
My/Image:1.2.0

Can watchtower be configured to detect an update to an image where the tag is incrementing like this from one version to the next? We don't use latest due to numerous problems some of which have been mentioned for example here: https://medium.com/@mccode/the-misunderstood-docker-tag-latest-af3babfd6375

If watchtower had semver support for tags, it would be brilliant as it could then tell if the new image was a new stable or unstable version, so for example, it could be configured on a production environment to only pull down new stable versions, as opposed to a CI or "Edge" environment where pulling pre-release images is acceptable.

Low Available Enhancement

Most helpful comment

I was just about to open a similar issue myself. :-) I'd love to see this one re-opened.

When I started using watchtower, I was very much hoping that this is a feature already available. Relying on mutable tags is… eh :-(

I have been thinking about concepts on how to approach this. The first problem is the written version in the docker-compose file. While restarting containers and pulling new images for a tag is no issue via the socket API, we would still have the wrong/old number in the docker-compose. When restarted, suddenly the old container would be pulled.
At this point we suddenly need to actively edit the compose-files, including support for ENV vars and all the crazy stuff the docker people came up with. And when running watchtower from a container itself, this is not so easily done.

I am not familiar enough with the socket API. Some even more ugly hacks that come to my mind: For the feature to work, containers need to have some special (not actually existing?) tag and need to depend on some dummy watchtower container - which then is able to hook the startup and force a certain version before the container starts…?

If it is not able to be done cleanly via the socket - which watchtower is using - maybe this feature could at least be used for notifications. Watchtower could send notifications if it finds and outdated (as per semver) container and help people to manually update.

All 9 comments

I also think this would be a very interesting thing to have

Great idea! Feel free to provide a PR and i'll look it through. 🙏

Closing due to lack of activity.

Yup sorry, I'd have to learn go language before I could begin to contribute, and at the moment it's taking all my reserves to stay afloat in dot net world.

Why this issue is closed?
I think it's a very good idea to be able to follow semver standard. So that watchtower could be configured to only upgrade when the second or the tired numbers increase. The first one is related to none backward compatibilities so in this case an automatic upgrade would be not welcomed.

I was just about to open a similar issue myself. :-) I'd love to see this one re-opened.

When I started using watchtower, I was very much hoping that this is a feature already available. Relying on mutable tags is… eh :-(

I have been thinking about concepts on how to approach this. The first problem is the written version in the docker-compose file. While restarting containers and pulling new images for a tag is no issue via the socket API, we would still have the wrong/old number in the docker-compose. When restarted, suddenly the old container would be pulled.
At this point we suddenly need to actively edit the compose-files, including support for ENV vars and all the crazy stuff the docker people came up with. And when running watchtower from a container itself, this is not so easily done.

I am not familiar enough with the socket API. Some even more ugly hacks that come to my mind: For the feature to work, containers need to have some special (not actually existing?) tag and need to depend on some dummy watchtower container - which then is able to hook the startup and force a certain version before the container starts…?

If it is not able to be done cleanly via the socket - which watchtower is using - maybe this feature could at least be used for notifications. Watchtower could send notifications if it finds and outdated (as per semver) container and help people to manually update.

Hi,

I was also looking for a way to get notifications as soon as a newer tag exists for a service I use...

Because I haven't found anything which fitted my needs, I came to code my own solution:
What's up Docker?

I'm relying on the Docker registry API to look for new versions
(semver if possible, regex fine tuning,...).

You can give it a try if you're interested... Feedback and contributions are welcome!

Please note that this tool is intended to trigger notifications only (no container automatic updates).

This issue has been closed? I’m quite surprised because watchtower is currently working based on an anti-pattern (update of latest tag).

Why is latest tag evil? You don’t really know which tag you are running. In case of a failure you want to roll back to previous version, but you can’t since you overwritten the latest tag.

It's closed due to no one picking it up to work on it. It's not that it's deemed a bad idea or anything, it's just that the currently open issues are the ones that have activity. If anyone wants to do a PR with this change we'd be happy to take a look at it!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simskij picture simskij  Â·  5Comments

Fredrik81 picture Fredrik81  Â·  5Comments

Ezwen picture Ezwen  Â·  6Comments

MakerTim picture MakerTim  Â·  6Comments

auanasgheps picture auanasgheps  Â·  6Comments