Skip to content
MrEditor97 edited this page Sep 25, 2025 · 3 revisions

It is possible to run this program within a Docker container (that is how it is run within the Home Assistant OS via the Red Reactor Add-on). So for those using Docker separately like I am, this should help to get you up and running.

I2C must be enabled already for this example to work.

For this example, we will use Ubuntu in our container.

  • Create a build folder

  • Create a file in the build folder called requirements.txt file containing the version of the Red Reactor service that you would like to install for example redreactor==0.1.3

  • Create a Dockerfile in the build folder and add in this:

    FROM python:latest
    
    # Environment variables
    ENV CONFIG=/etc/redreactor/config.yaml
    ENV LOG=/var/log/redreactor/redreactor.log
    ENV DATABASE=/etc/redreactor/database.db
    
    # Copy Python requirements file
    COPY requirements.txt /tmp/
    
    # Install required packages
    RUN \
        set -eux; \
        apt-get update; \
        apt-get install -y --no-install-recommends \
            gcc \
            musl-dev \
            linux-headers-generic \
        ; \
        apt-get dist-clean \
        && pip3 install --no-cache-dir -r /tmp/requirements.txt \
        \
        && rm -fr \
            /tmp/*
    
    # Start command
    CMD python -m redreactor --config=$CONFIG --log=$LOG --database=$DATABASE
    

    I haven't had chance to confirm that this exact configuration works, so please let me know if it doesn't and I will try to help!

  • Within your Docker Compose configuration add:

    version: "3.9"
    services:
        redreactor:
            container_name: redreactor
            build: ./redreactor/build
            restart: always
            environment:
                TZ: Europe/London
                CONFIG: /etc/redreactor/config.yaml
                DATABASE: /etc/redreactor/database.db
                LOG: /etc/redreactor/redreactor.log
            volumes:
                - ./redreactor/data:/etc/redreactor
                - /etc/localtime:/etc/localtime:ro
            devices:
                - /dev/i2c-1:/dev/i2c-1 # This is required for the Red Reactor I2C connection
            networks:
                - mqtt # Allow access to your MQTT network
    
  • It can then be build and started with Docker Compose with docker compose up redreactor

Hopefully this points you in the right direction to get you up and running! If you would like to get up and running faster, then I have Docker images that are pre-built for Home Assistant OS (they may work for other OS's however that has not been tested).

Clone this wiki locally