Keeping self hosted services updated...
... for the reckless. I have a few services running locally. Keeping them updated is getting more and more bothersome. There are a few things to keep in mind when using Docker images: Do not use latest
- you want to pin the version you are deploying and read the changelog / update notes before upgrading. More importantly, do not update without having read the changelog / update notes.
But when your ~/compose
directory looks like this
timo@alextrasza:~/compose$ ls
acme drawio grafana jellyfin memos ollama prometheus searxng tavern wyoming-whisper
ampache excalidraw homarr komga nextcloud openwebui roundcube sshwifty vaultwarden yarr
caddy floatplane homeassistant linkwarden nodered photoview roundcube2 stalwart wyoming-piper
this process becomes a good amount of work. This is one of the instances where I implore you to do as I say, not as I do. I've been self hosting things for a long time. I have nightly backups and usually kick off a backup before updating, so I can roll back easily if I have to. I also only run updates when I can spare 30 minutes to do a rollback if needed.
Let me tell you a secret - it was not necessary in the last 48 months to ever do a restore from a backup. Projects got really good at avoiding breaking changes and at having a clean migration path when running latest
. This goes very specifically for the projects I host myself - your mileage may vary. So, one more time: do not do the following in production with services you need to be online and available 24/7:
#!/bin/bash
BASE_PATH="/home/timo/compose"
ORIGINAL_DIR=$(pwd)
cd "$BASE_PATH" || { echo "Failed to enter directory: $BASE_PATH"; exit 1; }
for dir in */; do
if [ -d "$dir" ]; then
cd "$dir" || { echo "Failed to enter subdirectory: $dir"; continue; }
echo "Updating $dir"
docker compose pull
docker compose up -d
cd - > /dev/null || { echo "Failed to return to parent directory"; continue; }
fi
done
cd "$ORIGINAL_DIR" || { echo "Failed to return to original directory"; exit 1; }
echo "All compose setups updated."
This little script saves me a lot of typing, changing directories and running the same two commands repeatedly. But it also only works on my home network service host. Production follows best practices with tagged images, proper changelog review and updates outside of business hours.
posted on Aug. 24, 2025, 5:55 p.m. in homelab, infrastructure, self-hosting
This entry was posted as a "note" and did not undergo the same editing and review as regular posts.