Self-host part 1: RPi/Docker
Part 1 of self-hosting a few web services. This post deals with setting up a Raspberry Pi with Docker.
The first part of self-hosting a web service is preparation of the Raspberry Pi. I initially started with a Raspberry Pi 3, but I replaced it with my 4 after I realised I needed the extra RAM to run more containers.
Prepare the SD card
I had considered using an SSD, but I figured I could change it later.
Using the Raspberry Pi image tool
- Choose Raspberry OS Lite 64bit
- Set the Wi-Fi network
- Choose a hostname -this is used to reach the Pi over the network
- Choose an SSH username and password
- Image the card
SSH is used to log into the Pi remotely over a Terminal window, making it easy to update and manage the applications.
Once the Pi has booted and joined the network, open Terminal.
Update the OS
ssh username@hostname.local
"username" is the SSH name you set above, the "hostname" is the name you gave the Pi. When you enter the password, you won't see what you're typing, but press the return key, and you should be able to log in. Now it's worth checking for updates.
sudo apt update
sudo apt upgrade
If there are any updates, type Y and press the return key. It's useful at this stage to note the IP address of the Raspberry Pi. Use this command:
hostname -I
If possible, log into your router to fix that IP address so that if the Pi reboots, the IP will remain the same. It's not critical, but it's useful to know where things are.
Install Docker
Docker is a piece of software that lets you run a series of containers on your Pi. Each container runs its own code, keeping separate from the others. In my instance, I will run Docker images for FreshRSS, Readeck and Audiobookshelf.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
These commands firstly download and install Docker, and then ensures you, as an admin, have the correct permissions.