User and addon directory not populated whenusing Docker

Hi all,

I am trying to migrate to a Docker setup (Ubuntu 20.04) , but ran into some issue which I cannot grasp.

The following is happening:

  • Directories are created with the correct user/group.
  • Openhab starts, I am able to install addons, select a UI, can use homebuilder, save habpanel config.
  • The addons and userdata directories remain empty, no addons, no logs.
  • When I start a shell inside the container, I can view log messages via openhab-cli, but I
    have no idea where the log is stored.
  • When creating a file from the container shell into /opt/openhab/userdata the file is visible outside the
    container in /openhab/userdata, so mapping is correct.

1: Any idea why this is happening ?
2: Is it possible that the openhab-cli displays log messages, while they are not on disk ?
3: When using the docker image should the addon after installation always appear in the addons directory ?
4: Any other directons for trouble shooting ?

Just found the reason, which I just overlooked, openheb uses /openhab and not /opt/openhab inside the container. :slight_smile:

Thanks in advance,


Below the script I use to setup the directories and create a Docker container.

#!/bin/sh

sudo useradd -r -u 9001 -s /sbin/nologin openhab
sudo groupadd -g 9001 openhab
sudo usermod -a -G openhab ikke

mkdir -p /openhab/addons
mkdir -p /openhab/conf
mkdir -p /openhab/userdata

sudo chown -R openhab:openhab /openhab

docker run
–name openhab
–net=host
-v /etc/localtime:/etc/localtime:ro
-v /etc/timezone:/etc/timezone:ro
-v /openhab/addons:/opt/openhab/addons
-v /openhab/conf:/opt/openhab/conf
-v /openhab/userdata:/opt/openhab/userdata
-e “EXTRA_JAVA_OPTS=-Duser.timezone=Europe/Berlin”
–restart=always
openhab/openhab:2.5.9

The above should be

-v /openhab/addons:/openhab/addons
-v /openhab/conf:/openhab/conf
-v /openhab/userdata:/openhab/userdata

Internally in the container they are at /openhab and external volumes are at /openhab according to your post.

1 Like