Public Repository

Last pushed: 8 hours ago
Short Description
Official Homegear Docker images
Full Description

This is the official Homegear Docker image. It is based on Debian 9 (Stretch) and recreated with every new release.

Supported Tags

Configuration Files and Database

The following directories can be loaded from the host to keep the data and configuration files out of the container:

  • /etc/homegear
  • /var/lib/homegear
  • /var/log/homegear

Usage

To run the stable version of Homegear, execute the following commands.

  1. Create the data and log directories:

     mkdir -p /homegear-data/etc
     mkdir /homegear-data/lib
     mkdir /homegear-data/log
    
  2. Start Homegear using those directories and exposing ports 2001 to 2003. The name of the container is set to homegear. HOST_USER_ID and HOST_USER_GID are used to map a user of the host system to the user homegear within the Docker container. In the example they are set to the current user's UID and GID:

     docker run -d --rm -v /homegear-data/etc:/etc/homegear:Z -v /homegear-data/lib:/var/lib/homegear:Z -v /homegear-data/log:/var/log/homegear:Z -e TZ=Europe/Berlin -e HOST_USER_ID=$(id -u) -e HOST_USER_GID=$(id -g) -p 2001:2001 -p 2002:2002 -p 2003:2003 --name homegear homegear/homegear:stable
    
  3. To enter Homegear's CLI execute:

     docker exec -it homegear homegear -r
    

    To run a PHP command within Homegear's script engine, use:

     docker exec -it homegear homegear -e rc 'print $hg->getVersion();'
    

    To execute a script in the scripts directory:

     docker exec -it homegear homegear -e rs MyScript.php
    

Shutting Down

The default timeout of docker stop might not be large enough for Homegear to gracefully shutdown. Either set shutdown-timeout in daemon.json to 60 seconds or call docker stop with the timeout parameter:

docker stop --time 60 homegear

Additional Options

If you want to expose host devices to Homegear use the --device option. E. g. to expose /dev/ttyUSB0:

docker run -d --rm -v /homegear-data/etc:/etc/homegear:Z -v /homegear-data/lib:/var/lib/homegear:Z -v /homegear-data/log:/var/log/homegear:Z -e TZ=Europe/Berlin -e HOST_USER_ID=$(id -u) -e HOST_USER_GID=$(id -g) -p 2001:2001 -p 2002:2002 -p 2003:2003 --device=/dev/ttyUSB0 --name homegear homegear/homegear:stable

Documentation

Docker Pull Command
Owner
homegear