John Galea's Blog

My blog on Gadgets and the like

Upgrading your docker host

A while back I made the transition to docker containers running on Linux and love it. It’s light, fairly easy to maintain, performs well, can be pretty easily backed up and stable. I focused in on docker command line for deployments and ended up with scripts to create and update my containers. Most of these containers are pretty active so keeping them current, easily, is important. These updates can be anything from new features to security updates. Containers are often packaged with surrounding code that itself might be what’s being updated. At some point, your container host is going to be in need of upgrading, and that is where I was at. I was on Redhat 7.1. I could have considered an in place upgrade, but decided to use this as an opportunity to do some clean up and move forward all the way to current, Redhat 8.3, so I started from scratch. As part of the developer program I can use Redhat free of charge. So off I go … Installing Redhat 8.3 was simple and easy, then I did security updates, and lastly installed docker and I’m off to the races.

With some careful planning migrating containers to a new host is relatively painless. Two things make this easier, first off make sure that if the container provides services outside the container host, give the container it’s own IP. This makes moving it easier and more separated. This is pretty easy with the docker CLI, just use -p ipaddress:port:port, and add that new IP to the host. Second, insure you use volumes for the container data and config. That’s the -v in docker CLI. By clumping these volumes under one directory it makes backing up, and migration easy. You can even create separate drives for these container mount points. I did this for one of my containers who’s data is large and migration to a new host simply meant moving that drive. Doing this for every container can become a management nightmare, so I only recommend it for the bigger ones.

Another complication of migrating containers is communication between the containers. I have two that are problematic, one that monitors other containers and a reverse proxy. This inter container communication is done through the internal docker IPs, so moving the containers separately becomes a little more complicated.

I ran into one major issue which is that NGINX reverse proxy checks DNS at start up time, and if an item does not resolve it pukes. This is problematic on startup if the order is not exactly perfect. The fix for this, is to use IP addresses in NGINX not names. To facilitate this I moved all containers to fixed IP addresses for their docker network. This is achieved using the –ip directive of the CLI.

All this said, migration of container went super smoothly and all my containers are now on a new host good for many more years of stable happy fun. So what all have I containeried at this point? Well … Pihole (ad blocker), Plex server (DVR and media server), NIGINX (web server and reverse proxy with SSL), Photoshow (self hosted photo gallery), Photoprism (self hosted photo gallery take two, for me), Transmission (torrent downloader with built in VPN), Headphones (music manager), Sickchill (TV show auto downloader), mysql (database services for Kodi and other containers), kodi (headless to allow me to kick off new content scans) and Monitorr (a web interface to monitor everything on your home network with web links). All this is running in one Redhat 83 VM with 9G of RAM. I also have Nextcloud running in the house, by decided to have this on it’s own host, not as a container for easier management/updating.

March 19, 2021 Posted by | Uncategorized | Leave a comment