Sharing Our Passion for Technology
& Continuous Learning
Breathing New Life into an Old Laptop with RancherOS
While taking stock of my electronics graveyard I came across an old laptop. I had been looking for a reason to play with Docker containers and this laptop provided me an opportunity to do so. Since it was only going to be running Docker containers, I wanted a no-frills setup. RancherOS and resinOS are two options that met my minimalist criteria. Based on the recommendation of a colleague, I decided to go with RancherOS.
I downloaded the ISO version of RancherOS and loaded it on to a flash drive using Etcher. When I first tried to boot to the flash drive I got an error stating: “Could not find kernel image.” I fixed this by formatting the flash drive with FAT instead of FAT32 before loading the ISO with Etcher. I then followed the tutorial for installing RancherOS to disk.
Up to this point I had been using the laptop’s keyboard. Upon closing the laptop lid to store the laptop out of my children’s reach, the laptop promptly went to sleep. To change this behavior required delving into the functionality of RancherOS’ system Docker containers.
RancherOS uses two Docker instances: one to handle core system processes (e.g. ACPI, cron, console) and one to run user containers. Interacting with the system Docker instance turned out to be exactly the same as interacting with the user Docker instance, except that I had to run every command with elevated privileges (sudo
).
The lid-close behavior rested in RancherOS’ acpid container. To create a bash console in the acpid container, I had to execute the following command: sudo system-docker exec -i -t acpid /bin/bash
. The -i
option keeps the command interactive and the -t
option assigns a terminal to the command. I modified the /etc/acpi/events/lid
file by using vi
(i.e. vi /etc/acpi/events/lid
) and commenting out the line of code that contains action=/etc/acpi/suspend.sh %e
. The line looked like this after I was done: #action=/etc/acpi/suspend.sh %e
.
With the RancherOS server up, I loaded up my Unifi controller which had been running on a beleagured Raspberry Pi B+. Using the Docker image instructions, I was able to quickly get the Unifi controller running in RancherOS. I made sure any file system mount points were on /opt
or /home
folders as those are persisted between server restarts. Next, I set up my personal cloud storage using Resilio Sync. I plan to completely relieve my Raspberry Pi B+ of all responsibilites (for the time being) and move my Pi-Hole Server over to the RancherOS server using another Docker container.