Is there a global hook mechanism for Docker Watchtower?

358 Views Asked by At

I am currently developing a service composed of multiple containers, described in a docker-compose file.

I need an automated mechanism to update my container images. Watchtower seems to be an appropriate solution, except that i need to call a script before any of the containers update. The pre-update hook could do the trick, but i would have to duplicate my script in each images of my service.

Do you know if there is a way to add a "global hook" triggered if any container in my docker-compose is about to update ? If there is not, do you know which tool i should use to have this kind of behaviour ?

Thanks

1

There are 1 best solutions below

0
simme On

Unfortunately, this is not possible currently.

However, you can easily work around this by mounting your script file into the containers you want to check (preferably using read-only), as the lifecycle hooks allow you to execute script files. This would mean you don't have to duplicate the actual script for each container, but are able to keep it in one place.