/container-updater

A little bash script for alert and autoupdate container with Portainer.

Primary LanguageShell

PAPAMICA

🚀 A little bash script for alert and autoupdate containers deployed with docker run, docker-compose or Portainer.




🔵 Support of Docker hub (docker.io) and Github (ghcr.io) registries

🟣 Send notification to Discord (optionnal)

🔴 Send data to Zabbix (optionnal)

🔆 Discord notification example : ohunebellenotif

Requirements

jq, zabbix-sender (if you use Zabbix)

Use

git clone https://github.com/PAPAMICA/container-updater
cd container-updater
./container-updater.sh

If you use Github as registry, you need to set your personnal access token:

-g <access_tocken>

You can send notification to Discord with this argument:

-d <discord_webhook>

You can send data to Zabbix with this argument:

-z <zabbix_server>
-n <host_name> (optional)

You can blacklist packages for autoupdate:

-b <package,package>

For a daily execution, add a cron

00 09 * * * /chemin/vers/container-updater.sh -d <discord_webhook> -b <package,package> -z <zabbix_server> >> /var/log/container-updater.log

Monitoring

To supervise the updates of a container, you just have to add this label:

labels:
    - "autoupdate=monitor"

In this case, if an update is available, the script will simply send a notification to Discord. All you have to do is update the container.

Auto-update

To activate the automatic update of the container, you must add these labels:

docker run

-l "autoupdate=true" -l "autoupdate.docker-run=true"

docker-compose

labels:
    - "autoupdate=true"
    - "autoupdate.docker-compose=/link/to/docker-compose.yml"

Portainer

You need to have Portainer in enterprise version (free license up to 5 nodes). You can find the webhook in the stack or container settings.

labels:
    - "autoupdate=true"
    - "autoupdate.webhook=<webhook_url>"

To Do

  • Add private registry support
  • Better json generate for Discord notification
  • Others notifications support