To use easyHAB with an openHAB running in a docker container (instead of on a separate Raspberry PI or Mac mini), the following setup of the openHAB container is required.

This example is based on Docker on a Synology DSM.

1. Create Container in Synology Docker Manager

  • Search and download image “openhab/openhab (latest)”
  • Launch the image as new container with “Advanced Settings”:
    • Map Synology folders to store openHAB config data to container folders
      Screenshot 2022-02-05 at 12.20.36.png
    • Map required container ports to FIXED local ports (esp. SSH (22) and HTTP (8080) ports.
      Important: the external SSH port (922 in example below) is required in easyHAB configuration to contact the openHAB server/container.

  • Run the container (e.g. named “openhab” in this example) for first startup to create environment
  • Save the following script” in mapped /openhab/config folder
#!/bin/bash -x

## Log start time
date >> $HOME/laststart.log

## Check if SSH is already installed
isInstalled=`dpkg -l openssh-server | grep "<none>" | wc -l`
if [ $isInstalled -ne 0 ]
    ## install OpenSSH first
    sudo apt update
    sudo apt install --yes openssh-server

## Set OpenHAB Password
sudo bash -c 'echo "openhab:habopen" | chpasswd openhab'

## Start sshd
sudo /etc/init.d/ssh start

## EOF

2. Install PreCheck Script in Container

  • Update the default user password “habopen” for user openhab in precheck Script (marked red above)
  • Root console into Container (Container name = “openhab”): 
    docker exec -ti openhab /bin/bash 
  • In the container console execute all lines below:
    mkdir /etc/cont-init.d/
    cp /openhab/conf/ /etc/cont-init.d/
    chmod 770 /etc/cont-init.d/
    apt update
    apt install --yes sudo
    echo "openhab ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
  • Exit from container console & restart Docker Container.
    This installs & runs SSH Daemon, resets user password to the password set in the script.
  • Continue with easyHAB App to connect to the openHAB server in Docker container.
    Required data in easyHAB App:
    – Docker host IP (here: Synology IP address)
    – Mapped SSH port (here: 922)
    – Username “openhab”
    – User password (as set in the script)