Help: Notify on docker conainer updates

Hey guys

This question is not about HA docker container, I am running HA as a VM.

Apart from HA I am using a couple of docker containers for which it would be nice to get notified by HA whenever there are docker container updates available.
I am using docker-compose for all of those containers, so there may or may not be easy ways to implement container update notifications.
Any suggestions on how to set up such notifications?

Thank you in advance.

I have a rest sensor setup to track the latest tag at Docker Hub:

- resource: https://hub.docker.com/v2/namespaces/library/repositories/eclipse-mosquitto/tags/latest
  scan_interval: 86400
  sensor:
    name: Mosquitto Image
    json_attributes:
      - creator
      - id
      - images
      - last_updated
      - last_updater
      - last_updater_username
      - name
      - repository
      - full_size
      - v2
      - tag_status
      - tag_last_pulled
      - tag_last_pushed
      - media_type
      - digest
    value_template:  >-
      {{ value_json.tag_status }}

Then I have an automation that is triggered on a state change for that sensor. In my case I set an input boolean with the same name as the sensor so I have a visual list of stuff that needs updating (and can ignore the update by turning it off. I’ve simplified this a bit for the example, as I’m tracking other updates from things like GitHub, HACS, etc.

alias: System Check for Component Updates
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.mariadb_image
      - sensor.iperf3_image
      - sensor.nextpvr_image
      - sensor.mosquitto_image
    attribute: last_updated
condition: []
action:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{trigger.to_state.entity_id.startswith('binary_sensor.')}}"
        sequence:
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.{{trigger.to_state.entity_id[14:]}}
    default:
      - service: input_boolean.turn_on
        data: {}
        target:
          entity_id: input_boolean.{{trigger.to_state.entity_id[7:]}}
mode: single

And then one more automation to trigger an actual notification:

alias: System Notify on Updates Available
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.iperf3_image
      - input_boolean.mariadb_image
      - input_boolean.mosquitto_image
      - input_boolean.nextpvr_image
    to: "on"
    from: "off"
condition: []
action:
  - service: persistent_notification.create
    data:
      title: Updates Available
      message: "{{ trigger.to_state.name }}"
mode: queued

It’s probably more complicated than it needs to be, but it does work. If you don’t need a visual list of updates, you could probably have the notification trigger in the first automation and not have the second automation at all.

There is a custom integration that can do this: