I’ve been playing around with regex and here are some examples in case others would like to use them.
Use with @Lapatoc’s code.
Find the latest tag that does not include characters (original): {% for result in results if not result.name |regex_search("[a-z]",ignorecase=TRUE) -%}
Find the latest tag named #.#.# (eg. 0.88.2) {% for result in results if result.name |regex_search("\d+\.\d+\.\d+$") -%}
Find the latest tag named #.#.#something (eg. 0.89.2b2) {% for result in results if result.name |regex_search("\d+\.\d+\.\d+") -%}
Find the latest tag named #.# (eg. 2.6) {% for result in results if result.name |regex_search("\d+\.\d+$") -%}
Find the latest version named amd64-#.#.# (eg. amd64-2.05.59) {% for result in results if result.name |regex_search("amd64-\d+\.\d+\.\d+$") -%}
Has anyone figured out how to get the versions of containers in other things apart from HA?
I have Zigbee2MQTT and NginX running and I’d like to get those if possible. I’ve had a look at docker inspect and unfortunately Zigbee2MQTT doesn’t report it back. I have found it in the log however I’ve no idea how I’d parse that back to HA.
With NginX I can get the build version but it’s in a really long format: Linuxserver.io version:- 0.32.0-ls15 Build-date:- 2019-03-30T16:26:24+00:100:
This doesn’t seem to work in HA either
Do you know what the secret is to getting version info from “Official” repositories?
This is the one I am trying to get updated info for; I could try to pull from this page but I like to keep all my sensors similar. I have seven others that work great but there is something about this one that gets me.
I was thinking about this today.
I use a docker container called DIUN (Docker Image Update Notifier) - https://github.com/crazy-max/diun
This monitors your docker containers and looks for updated images on a regular basis. It can send notifications and, having checked today, it can also sent notifications to MQTT or WebHook, which means it could be used to trigger HASS.
Watchtower could well do this as well, but doesn’t have MQTT or Webhook - I’ve raised a new feature request on their GitHub for this.
I ended up going a different route on this.
I have a cronjob script run to download the newest image (just download), since docker will only download if there is an updated version of whatever tag you are using.
Then I compare the number of docker images with the number of containers. If there are more images then containers then I have a container to update. This works for me based on my setup; I have all my containers restart (this works for all except MaryTTS sometimes for some reason). I don’t have containers that don’t run (most of the time).
I am debating, since I think I am stable at the number of containers I run, just grep the name of images and if the count is more than one then that one is in need of updating.
Doing it this way has the benefit of not having to wait on a container to download when I find an update is available.
I didn’t like certain aspects of docker-compose; I found it difficult to manage images independently and still have them interact on the same docker network. I’m sure if I play with it long enough I could get it to work, but my way works for me (currently).
I have the same need.
(tracking down my Docker containers to get notified when updates are available)
and I ended up with my own solution: What’s up Docker?
I did try integrating DIUN with HASS once. You can do it either via sending a webhook to HASS, or by using MQTT.
It worked, but I found it annoying that I had to setup individual entities for each and every container individually to achieve what I wanted.