Installing Homebridge in a Docker container on a Raspberry Pi

How to install homebridge in a docker container on a Raspberry Pi

This process should be pretty similar, regardless of the device, so long as you have Docker installed, but this image is specifically designed for the Raspberry Pi.

Prerequisites

You will need Docker installed on your Raspberry Pi.

Review the homebridge containter image information, make sure you have a compatable Raspberry Pi, and familiarise yourself with what’s in the image and any changes that might have been made since this article was made.

Install Docker Compose

To check if you have Docker Compose installed, run the below command in a terminal window:

docker-compose

If you see the below response, run the below command to install Docker Compose:

sudo apt-get -y install docker-compose

Find your UID and GID

You’ll need your UID and GID, which will be usered in the command in the next step. To find these, presuming you’re using the default pi user, run the below command:

id pi

Create a Homebridge Docker Compose Manifest

Create and navigate to a new folder using the below commands in a terminal window:

mkdir /home/pi/homebridge
cd /home/pi/homebridge

Create a new file using the below command:

nano docker-compose.yml

Update the below with your UID, PID and preferred port, and paste it into the new file you created:

version: '2'

services:
  homebridge:
    image: oznu/homebridge:raspberry-pi
    restart: unless-stopped
    network_mode: host
    volumes:
      - ./config:/homebridge
    environment:
      - PGID=1000
      - PUID=1000
      - HOMEBRIDGE_CONFIG_UI=1
      - HOMEBRIDGE_CONFIG_UI_PORT=8080

Press CTRL + X to close the editor

When prompted about saving the changes, press Y for Yes.

Press enter, without changing the file name.

You will return to the terminal window after the updates are saved.

Install homebridge in a docker containter

In the same folder as your newly created docker-compose.yml file, as detailed above, run the below command to create a Homebridge Docker container:

docker-compose up -d

-d is used to set the container to run as a background process.

You’ll see it start to download the files and install them, please be patient.

When you see the below, the Homebride Docker containter is installed.

View your Docker containers

You can view your containers by running the below command:

docker ps

If you don’t see your containter, try appending an -a to show all containers, even those not running.

docker ps -a

If everything is running, you can now start using Homebridge by browsing the admin portal:

http://servername:8080

You can replace the servername with the IP, and don’t forget to change the port, if you changed it during the install.

The default credentials are:

Username: admin
Password: admin

For help configuring Homebridge, please check out my other articles.

Be the first to comment

Leave a Reply

Your email address will not be published.


*