You may have a need to keep multiple versions of an executable (like java) on your system. Perhaps most of your system will work with Java 8, but one application needs Java 7.
The alternatives program lets you switch from one version to another, quickly.
EDIT: For other reasons you may want to do this, see What is the difference between JAVA_HOME and update-alternatives? and Better way to add alternative using update-alternatives?
From man alternatives:
It is possible for several programs fulfilling the same or similar functions to be installed on a single system at the same time. For example, many systems have several text editors installed at once. This gives choice to the users of a system, allowing each to use a different editor, if desired, but makes it difficult for a program to make a good choice of editor to invoke if the user has not specified a particular preference.
The alternatives system aims to solve this problem. A generic name in the filesystem is shared by all files providing interchangeable functionality. The alternatives system and the system administrator together determine which actual file is referenced by this generic name.
Answer from StandardEyre on Stack Exchange
docker - Why use the alternatives command? - Unix & Linux Stack Exchange
Use update-alternatives for docker-compose
What's the best Docker updates management tool?
Creating a docker container with a specific compiler version requires update-alternatives to be added as the last line of the Dockerfile - Stack Overflow
Videos
Hi everyone, I'm in the process of migrating from TrueNas apps to native docker compose. I'd like to handle updates the easiest way. Ideally, this would mean :
-
automatically update certain non-critical containers
-
notify me when updates are available for critical containers and allow for a one-click update.
Watchtower is great for the first scenario but is there anything that can also handle the second one?
I've been discovering docker in the past days and I now have several containers running on my Synology NAS via docker compose.
I was wondering how I can keep my containers up to date so that I don't miss security updates but I don't know how to best deal with it.
The first option I found would be to regularly go in each and every folder where my docker-compose files are and do the following but it's too tedious to do it very regularly :
docker compose pull && docker compose up -d
The second option I came across is Watchtower but I read mixed things about it.
How do you handle this? Is there a more elegant solution?
Thanks!
I've been using Watchtower with Pushover notifications and haven't had a issue since 3-4 years (Roughly) but it seems like the project is almost abandoned just looking at the github page no updates in 2+ years. Thoughts ?
Hey,
just saw that: https://github.com/containrrr/watchtower is no longer maintained.
I use Watchtower to automatically update my Docker containers and notify me via nfty.
The original creator stated "There are a few forks out there - unfortunately I know nothing about them so can't really vouch for their legitimity. If you want to continue using Watchtower, please assess them yourself without switching. A few of the active forks I've looked at are full of AI slop and while they might work, I wouldn't advice using any of them."
Now I am wondering if this https://github.com/nicholas-fedor/watchtower is a decent fork or if its the so called AI slop? I'm no expert myself and cant confirm this for myself unfortunately.
What do you guys think?
Hey everyone,
I’m fairly new to self-hosting and Docker, and I’m curious how others handle keeping their containers up to date.
What are your best practices for:
-
Pulling updated images
-
Restarting containers with minimal downtime
-
Running updates automatically or in the background
-
Avoiding breaking changes when images update
Do you rely on tools like Watchtower, custom scripts + cron, CI/CD pipelines, or manual updates?
I’d love to hear what’s been working well for you (and what you’d avoid). Thanks!