Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker notification on new image version

I am trying to build a docker image which is based on the official node docker image and was wondering if there is some way of automatically rebuilding the image when a new version of the official node image gets pushed. So that my image isn't based on an outdated base image.

Maybe there is some way like rss-feed, where updates to the official images get published, so that I could listen to that feed?

Or is there some other way to get notified by new images on the official docker-registry?

like image 591
andreas-fahrecker Avatar asked Nov 01 '25 06:11

andreas-fahrecker


1 Answers

By default, updates of base Docker images must be manually pulled and applied to each running container.

Hence, you are probably looking for a third-party tool like Watchtower, which automates the process of detecting updates for your Docker container’s base image.

Specifically, the aforementioned tool watches a specified Docker image repository for new Docker image pushes. This repository can be either private or public, and hosted on the Docker Hub registry or on your own image registry.

In your case, you can create a docker-compose file, as shown below:

version: "3"
services:
  node:
    image: node:fermium-alpine3.16
    container_name: fahrecker-node-container
  watchtower:
    image: containrrr/watchtower
    container_name: watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: fahrecker-node-container

Finally, you may also enable email notification functionality, by adding a few environmental variables, as shown below:

environment:
  WATCHTOWER_MONITOR_ONLY: 'true'
  WATCHTOWER_NOTIFICATIONS: email
  WATCHTOWER_NOTIFICATION_EMAIL_FROM: <EMAIL_FROM>
  WATCHTOWER_NOTIFICATION_EMAIL_TO: <EMAIL_TO>
  WATCHTOWER_NOTIFICATION_EMAIL_SERVER: smtp.provider.com
  WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PORT: 587 (in most cases)
  WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER: <YOUR_EMAIL>
  WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD: <YOUR_PASSWORD>
like image 151
Andreas Violaris Avatar answered Nov 02 '25 20:11

Andreas Violaris