Install Homebridge in Docker on Raspberry Pi

I am running Docker on my Raspberry Pi to run Homebridge and phoscon which allows me to connect zigbee devices like Aqara water sensor to Home Kit.

This is part one of several instructions to get zigbee running with Home Kit.

This could be done without Docker by installing everything in Raspberian, but putting it in Docker containers allows me to keep things separate which will simplify maintenance and upgrades in the future.

Install the OS

I downloaded the Raspberry Pi OS Lite image, and transferred to the SD card from my desktop using dd.

After copying the image to the SD card, I enabled ssh by creating an ssh file in the root of the volume

touch ssh

I put the SD card in the Pi, connect ethernet, booted up, then ssh into the Pi

ssh pi@[ip address]

The default password is raspberry

I change the password, and set time zone using

sudo raspi-config

I use a static IP on my Raspberry Pi by editing etc/dhcpdc.conf and uncommenting the static ip settings

Allow accessing the server using [hostname].local

sudo apt-get install avahi-utils

Update the OS

sudo apt-get update && sudo apt-get upgrade

Install docker on Raspberry Pi

Install Docker

curl -sSL https://get.docker.com | sh

Add pi user to the Docker Group so I can run docker without root.

sudo usermod -aG docker ${USER}

Install Docker-Compose

sudo apt-get install -y libffi-dev libssl-dev
sudo apt-get install -y python3-dev
sudo apt-get install -y python3 python3-pip
sudo pip3 install docker-compose

Set docker to start on boot

sudo systemctl enable docker

Docker is now installed, and we can continue on to building the Homebridge docker container and the phoscon docker container