Keep your containers updated with What's up Docker?

Monitor Other Docker Hosts

To enable WUD to monitor containers on other Docker hosts, add an extra environment variable for a host instead of a socket (the default option). You can also set different properties for that host, for instance,

environment:
      - WUD_WATCHER_LOCAL_CRON=5 3 * * *
      - WUD_WATCHER_RUBUS_HOST=rubus.home
      - WUD_WATCHER_RUBUS_CRON=5 4 * * *

On that host, the Docker engine must be configured to listen on port 2375. Instructions can be found in the Docker documentation about remote access [9]. The RUBUS in the environment variable is a name you can choose (which can differ from the hostname), while LOCAL always refers to the host where WUD is running.

After running docker-compose up -d, WUD shows containers from all hosts defined in its watchers, in a path-like notation: first the watcher's name, then the container registry, the container (with its defined name and icon), and then the version, optionally followed by the latest available new version (Figure 6).

Figure 6: WUD easily monitors containers from multiple Docker hosts.

Add Triggers

Now that you see all available updates for your containers in WUD's web interface, you still need to check this web page manually. However, you can define triggers to receive notifications when an update becomes available for your containers. WUD currently supports around 15 types of triggers, including email, ntfy [10], MQTT, Slack, Telegram, and Discord.

I'll demonstrate how to configure a trigger that emails you each available update. Use the environment variables from Listing 2 for the WUD container. This example uses Mailjet [11], a French email provider allowing up to 200 emails per day under its free plan. Populate these fields with your account information from your own email provider.

Listing 2

Email Trigger Configuration

    environment:
      - WUD_TRIGGER_SMTP_MAILJET_HOST=in-v3.mailjet.com
      - WUD_TRIGGER_SMTP_MAILJET_PORT=587
      - WUD_TRIGGER_SMTP_MAILJET_USER=17326117626d402dadc3864b59000095
      - WUD_TRIGGER_SMTP_MAILJET_PASS=73c460f8d48b4d159c273b1a6ba4ae8a
      - WUD_TRIGGER_SMTP_MAILJET_FROM=wud@example.com
      - WUD_TRIGGER_SMTP_MAILJET_TO=me@example.com

After restarting the WUD container, you'll receive an email whenever a new version is available for one of your containers, including a link to the release notes for quick verification whether updating is recommended.

If you've set up the notification service ntfy, you can add a trigger with the configuration from Listing 3. Make sure to set a username and password for an account that has write permissions for the topic, and use the correct URL. If the ntfy container runs from the same Docker Compose file, both containers are in the same network, so you can just use the container name (ntfy in this example) as the hostname. If successful, you'll see alerts about new updates in ntfy's Android app (Figure 7).

Listing 3

Ntfy Trigger Configuration

    environment:
      - WUD_TRIGGER_NTFY_LOCAL_URL=http://ntfy
      - WUD_TRIGGER_NTFY_LOCAL_AUTH_USER=wud
      - WUD_TRIGGER_NTFY_LOCAL_AUTH_PASSWORD=wafpjuN04CCSFy8TFnGK
      - WUD_TRIGGER_NTFY_LOCAL_TOPIC=wud
Figure 7: Get alerts about container updates in the ntfy app for Android.

Update Your Docker Compose File

WUD triggers are not only useful for notifications. One available trigger is for Docker Compose. When you have this configured, WUD updates your Docker Compose file with the new version tag and recreates the container upon detecting an update. As previously explained, automating this process is not recommended. However, you can add the trigger and configure WUD to not execute it automatically. This allows manual triggering from WUD's web interface to update the container. Note that this functionality is only available for the local Docker host.

Configuration is once again done using the appropriate environment variables for the WUD container, but you also need to mount your Docker Compose file inside the container for modifications. Listing 4 illustrates this setup. With WUD_TRIGGER_DOCKERCOMPOSE_LOCAL_PRUNE=true, WUD removes the old image post-update, while WUD_TRIGGER_DOCKERCOMPOSE_LOCAL_AUTO=false disables automatic trigger execution.

Listing 4

Update Docker Compose File from WUD Web Interface

    volumes:
      - ./docker-compose.yml:/wud/docker-compose.yml
    environment:
      - WUD_TRIGGER_DOCKERCOMPOSE_LOCAL_FILE=/wud/docker-compose.yml
      - WUD_TRIGGER_DOCKERCOMPOSE_LOCAL_PRUNE=true
      - WUD_TRIGGER_DOCKERCOMPOSE_LOCAL_AUTO=false

After docker-compose up -d, explore the Triggers tab in WUD's web interface to view all configured triggers for each container (Figure 8). Click Run beside the Docker Compose trigger to update the container via a Docker Compose file modification. If your containers are defined in multiple Docker Compose files, just add all files as volumes and add extra environment variables WUD_TRIGGER_DOCKERCOMPOSE_{OTHER}_FILE, WUD_TRIGGER_DOCKERCOMPOSE_{OTHER}_PRUNE, and WUD_TRIGGER_DOCKERCOMPOSE_{OTHER}_AUTO.

Figure 8: Modify the Docker Compose file and recreate the container with one click.

Buy this article as PDF

Download Article PDF now with Express Checkout
Price $2.95
(incl. VAT)

Buy Linux Magazine

Related content

  • Push Notifications

    If you host a lot of services on your home server, it helps to have them send you timely notifications. With ntfy, you can send push notifications to your phone or desktop.

  • Chore Conqueror

    Are you struggling to keep track of all your household chores? With its intuitive interface and advanced features, Donetick ensures you won't forget them.

  • Docker Open Source Developer Tools

    Docker provides the open source tools and resources for compiling, building, and testing containerized applications.

  • Plant-it

    To keep your garden and indoor plants alive, you must remember to water them on time, apply fertilizers, and more. Plant-it is a self-hosted garden companion designed to assist you in achieving these tasks.

  • Seafile 9

    Seafile offers file sharing and synchronization like Nextcloud and ownCloud, but its speed leaves the competition far behind.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News