First try to run Openhab in a docker on Ubuntu

Looks like it is a docker issue.
with docker container inspect
I don´t see a ip address

NetworkSettings": {
            "Bridge": "",
            "SandboxID": "47a16baccc8267ff2432a75852020368e9eab5f177e84eccc62d9fa9611df82b",
            "SandboxKey": "/var/run/docker/netns/default",
            "Ports": {},
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",

That’s normal for a container running in host mode networking. My OH in Docker works and has identical values (except for the ID and key of course).

So I took the original docker-compose.yaml at the top of the thread:

version: '2.2'

services:
  openhab:
    image: "openhab/openhab:4.1.1"
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "/home/mynuc/docker/openhab4.1.1/addons:/openhab/addons"
      - "/home/mynuc/docker/openhab4.1.1/conf:/openhab/conf"
      - "/home/mynuc/docker/openhab4.1.1/userdata:/openhab/userdata"
    environment:
      CRYPTO_POLICY: "unlimited"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Amsterdam"
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"

volumes:
  openhab_addons:
    driver: local
  openhab_conf:
    driver: local
  openhab_userdata:
    driver: local

created the directories:

mkdir -p /home/mynuc/docker/openhab4.1.1/addons
mkdir -p /home/mynuc/docker/openhab4.1.1/conf
mkdir -p /home/mynuc/docker/openhab4.1.1/userdata
sudo chown -R $USER:$USER /home/mynuc/docker/openhab4.1.1

Started up the container:

docker compose up
docker-host:/home/mynuc$ docker ps
CONTAINER ID   IMAGE                           COMMAND                  CREATED         STATUS                            PORTS                                                                                            NAMES
221cd7425ab4   openhab/openhab:4.1.1           "/entrypoint gosu op…"   3 minutes ago   Up 2 minutes (health: starting)                                                                                                    mynuc-openhab-1

My implementation just kind of hung like you are describing…

I’d recommend the following:

sudo useradd -r -s /sbin/nologin openhab
sudo usermod -a -G openhab openhab

Per the documentation here:

Determine the USER_ID and GROUP_ID:

docker-host:/home/mynuc$ grep openhab /etc/passwd
openhab:x:9001:9001:openhab runtime user,,,:/var/lib/openhab:/bin/false

^^^^^ This is your USER_ID

docker-host:/home/mynuc$ grep openhab /etc/group
openhab:x:9001:

^^^^^ This is your GROUP_ID

At a minimum edit your docker-compose.yaml like this:

version: '2.2'

services:
  openhab:
    image: "openhab/openhab:4.1.1"
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "/home/mynuc/docker/openhab4.1.1/addons:/openhab/addons"
      - "/home/mynuc/docker/openhab4.1.1/conf:/openhab/conf"
      - "/home/mynuc/docker/openhab4.1.1/userdata:/openhab/userdata"
    environment:
      CRYPTO_POLICY: "unlimited"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Amsterdam"
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"
      USER_ID: "9001"
      GROUP_ID: "9001"
volumes:
  openhab_addons:
    driver: local
  openhab_conf:
    driver: local
  openhab_userdata:
    driver: local

Note the new lines USER_ID and GROUP_ID

docker compose up

The output of docker compose up should look like this:

docker-host:/home/mynuc$ docker compose up
[+] Running 1/0
 ✔ Container mynuc-openhab-1  Created                                                                                                                               0.0s
Attaching to openhab-1
openhab-1  | + IFS='
openhab-1  |    '
openhab-1  | ++ find /usr/lib/jvm -maxdepth 1 -name '*jdk*' -type d
openhab-1  | Configuring Java unlimited strength cryptography policy...
openhab-1  | + export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
openhab-1  | + JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
openhab-1  | + '[' unlimited = unlimited ']'
openhab-1  | + echo 'Configuring Java unlimited strength cryptography policy...'
openhab-1  | + sed -i 's/^crypto.policy=limited/crypto.policy=unlimited/' /usr/lib/jvm/java-17-openjdk-amd64/conf/security/java.security
openhab-1  | + capsh --print
openhab-1  | + grep -E Current:.+,cap_net_admin,cap_net_raw,.+
openhab-1  | + rm -f '/var/lock/LCK..*'
openhab-1  | + rm -f /openhab/userdata/tmp/instances/instance.properties
openhab-1  | + NEW_USER_ID=9001
openhab-1  | + NEW_GROUP_ID=9001
openhab-1  | + echo 'Starting with openhab user id: 9001 and group id: 9001'
openhab-1  | Starting with openhab user id: 9001 and group id: 9001
openhab-1  | + id -u openhab
openhab-1  | ++ getent group 9001
openhab-1  | + '[' -z '' ']'
openhab-1  | + echo 'Create group openhab with id 9001'
openhab-1  | + groupadd -g 9001 openhab
openhab-1  | Create group openhab with id 9001
openhab-1  | Create user openhab with id 9001
openhab-1  | + echo 'Create user openhab with id 9001'
openhab-1  | + adduser -u 9001 --disabled-password --gecos '' --home /openhab --gid 9001 openhab
openhab-1  | Warning: The home dir /openhab you specified already exists.
openhab-1  | Adding user `openhab' ...
openhab-1  | Adding new user `openhab' (9001) with group `openhab' ...
openhab-1  | adduser: Warning: The home directory `/openhab' does not belong to the user you are currently creating.
openhab-1  | The home directory `/openhab' already exists.  Not copying from `/etc/skel'.
openhab-1  | + groupadd -g 11 audio2
openhab-1  | + groupadd -g 14 uucp2
openhab-1  | + groupadd -g 16 dialout2
openhab-1  | + groupadd -g 17 audio3
openhab-1  | + groupadd -g 18 dialout3
openhab-1  | + groupadd -g 32 uucp3
openhab-1  | + groupadd -g 63 audio4
openhab-1  | + groupadd -g 490 dialout4
openhab-1  | + groupadd -g 492 audio5
openhab-1  | + groupadd -g 997 gpio
openhab-1  | + adduser openhab audio
openhab-1  | Adding user `openhab' to group `audio' ...
openhab-1  | Adding user openhab to group audio
openhab-1  | Done.
openhab-1  | + adduser openhab audio2
openhab-1  | Adding user `openhab' to group `audio2' ...
openhab-1  | Adding user openhab to group audio2
openhab-1  | Done.
openhab-1  | + adduser openhab audio3
openhab-1  | Adding user `openhab' to group `audio3' ...
openhab-1  | Adding user openhab to group audio3
openhab-1  | Done.
openhab-1  | + adduser openhab audio4
openhab-1  | Adding user `openhab' to group `audio4' ...
openhab-1  | Adding user openhab to group audio4
openhab-1  | Done.
openhab-1  | + adduser openhab audio5
openhab-1  | Adding user `openhab' to group `audio5' ...
openhab-1  | Adding user openhab to group audio5
openhab-1  | Done.
openhab-1  | + adduser openhab dialout
openhab-1  | Adding user `openhab' to group `dialout' ...
openhab-1  | Adding user openhab to group dialout
openhab-1  | Done.
openhab-1  | + adduser openhab dialout2
openhab-1  | Adding user `openhab' to group `dialout2' ...
openhab-1  | Adding user openhab to group dialout2
openhab-1  | Done.
openhab-1  | + adduser openhab dialout3
openhab-1  | Adding user `openhab' to group `dialout3' ...
openhab-1  | Adding user openhab to group dialout3
openhab-1  | Done.
openhab-1  | + adduser openhab dialout4
openhab-1  | Adding user `openhab' to group `dialout4' ...
openhab-1  | Adding user openhab to group dialout4
openhab-1  | Done.
openhab-1  | + adduser openhab gpio
openhab-1  | Adding user `openhab' to group `gpio' ...
openhab-1  | Adding user openhab to group gpio
openhab-1  | Done.
openhab-1  | + adduser openhab uucp
openhab-1  | Adding user `openhab' to group `uucp' ...
openhab-1  | Adding user openhab to group uucp
openhab-1  | Done.
openhab-1  | + adduser openhab uucp2
openhab-1  | Adding user `openhab' to group `uucp2' ...
openhab-1  | Adding user openhab to group uucp2
openhab-1  | Done.
openhab-1  | + adduser openhab uucp3
openhab-1  | Adding user `openhab' to group `uucp3' ...
openhab-1  | Adding user openhab to group uucp3
openhab-1  | Done.
openhab-1  | + initialize_volume /openhab/conf /openhab/dist/conf
openhab-1  | + volume=/openhab/conf
openhab-1  | + source=/openhab/dist/conf
openhab-1  | ++ ls -A /openhab/conf
openhab-1  | Initializing empty volume /openhab/conf ...
openhab-1  | + '[' -z '' ']'
openhab-1  | + echo 'Initializing empty volume /openhab/conf ...'
openhab-1  | + cp -av /openhab/dist/conf/. /openhab/conf/
openhab-1  | '/openhab/dist/conf/./html' -> '/openhab/conf/./html'
openhab-1  | '/openhab/dist/conf/./html/index.html' -> '/openhab/conf/./html/index.html'
openhab-1  | '/openhab/dist/conf/./html/readme.txt' -> '/openhab/conf/./html/readme.txt'
openhab-1  | '/openhab/dist/conf/./icons' -> '/openhab/conf/./icons'
openhab-1  | '/openhab/dist/conf/./icons/classic' -> '/openhab/conf/./icons/classic'
openhab-1  | '/openhab/dist/conf/./icons/classic/readme.txt' -> '/openhab/conf/./icons/classic/readme.txt'
openhab-1  | '/openhab/dist/conf/./items' -> '/openhab/conf/./items'
openhab-1  | '/openhab/dist/conf/./items/readme.txt' -> '/openhab/conf/./items/readme.txt'
openhab-1  | '/openhab/dist/conf/./persistence' -> '/openhab/conf/./persistence'
openhab-1  | '/openhab/dist/conf/./persistence/readme.txt' -> '/openhab/conf/./persistence/readme.txt'
openhab-1  | '/openhab/dist/conf/./rules' -> '/openhab/conf/./rules'
openhab-1  | '/openhab/dist/conf/./rules/readme.txt' -> '/openhab/conf/./rules/readme.txt'
openhab-1  | '/openhab/dist/conf/./scripts' -> '/openhab/conf/./scripts'
openhab-1  | '/openhab/dist/conf/./scripts/readme.txt' -> '/openhab/conf/./scripts/readme.txt'
openhab-1  | '/openhab/dist/conf/./services' -> '/openhab/conf/./services'
openhab-1  | '/openhab/dist/conf/./services/addons.cfg' -> '/openhab/conf/./services/addons.cfg'
openhab-1  | '/openhab/dist/conf/./services/readme.txt' -> '/openhab/conf/./services/readme.txt'
openhab-1  | '/openhab/dist/conf/./services/runtime.cfg' -> '/openhab/conf/./services/runtime.cfg'
openhab-1  | '/openhab/dist/conf/./sitemaps' -> '/openhab/conf/./sitemaps'
openhab-1  | '/openhab/dist/conf/./sitemaps/readme.txt' -> '/openhab/conf/./sitemaps/readme.txt'
openhab-1  | '/openhab/dist/conf/./sounds' -> '/openhab/conf/./sounds'
openhab-1  | '/openhab/dist/conf/./sounds/barking.mp3' -> '/openhab/conf/./sounds/barking.mp3'
openhab-1  | '/openhab/dist/conf/./sounds/doorbell.mp3' -> '/openhab/conf/./sounds/doorbell.mp3'
openhab-1  | '/openhab/dist/conf/./tags' -> '/openhab/conf/./tags'
openhab-1  | '/openhab/dist/conf/./tags/readme.txt' -> '/openhab/conf/./tags/readme.txt'
openhab-1  | '/openhab/dist/conf/./things' -> '/openhab/conf/./things'
openhab-1  | '/openhab/dist/conf/./things/readme.txt' -> '/openhab/conf/./things/readme.txt'
openhab-1  | '/openhab/dist/conf/./transform' -> '/openhab/conf/./transform'
openhab-1  | '/openhab/dist/conf/./transform/de.map' -> '/openhab/conf/./transform/de.map'
openhab-1  | '/openhab/dist/conf/./transform/en.map' -> '/openhab/conf/./transform/en.map'
openhab-1  | '/openhab/dist/conf/./transform/readme.txt' -> '/openhab/conf/./transform/readme.txt'
openhab-1  | + initialize_volume /openhab/userdata /openhab/dist/userdata
openhab-1  | + volume=/openhab/userdata
openhab-1  | + source=/openhab/dist/userdata
openhab-1  | ++ ls -A /openhab/userdata
openhab-1  | + '[' -z '' ']'
openhab-1  | + echo 'Initializing empty volume /openhab/userdata ...'
openhab-1  | + cp -av /openhab/dist/userdata/. /openhab/userdata/
openhab-1  | Initializing empty volume /openhab/userdata ...
openhab-1  | '/openhab/dist/userdata/./etc' -> '/openhab/userdata/./etc'
openhab-1  | '/openhab/dist/userdata/./etc/all.policy' -> '/openhab/userdata/./etc/all.policy'
openhab-1  | '/openhab/dist/userdata/./etc/branding-ssh.properties' -> '/openhab/userdata/./etc/branding-ssh.properties'
openhab-1  | '/openhab/dist/userdata/./etc/branding.properties' -> '/openhab/userdata/./etc/branding.properties'
openhab-1  | '/openhab/dist/userdata/./etc/config.properties' -> '/openhab/userdata/./etc/config.properties'
openhab-1  | '/openhab/dist/userdata/./etc/custom.properties' -> '/openhab/userdata/./etc/custom.properties'
openhab-1  | '/openhab/dist/userdata/./etc/custom.system.properties' -> '/openhab/userdata/./etc/custom.system.properties'
openhab-1  | '/openhab/dist/userdata/./etc/distribution.info' -> '/openhab/userdata/./etc/distribution.info'
openhab-1  | '/openhab/dist/userdata/./etc/equinox-debug.properties' -> '/openhab/userdata/./etc/equinox-debug.properties'
openhab-1  | '/openhab/dist/userdata/./etc/java.util.logging.properties' -> '/openhab/userdata/./etc/java.util.logging.properties'
openhab-1  | '/openhab/dist/userdata/./etc/jmx.acl.org.apache.karaf.bundle.cfg' -> '/openhab/userdata/./etc/jmx.acl.org.apache.karaf.bundle.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/jmx.acl.org.apache.karaf.config.cfg' -> '/openhab/userdata/./etc/jmx.acl.org.apache.karaf.config.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/jre.properties' -> '/openhab/userdata/./etc/jre.properties'
openhab-1  | '/openhab/dist/userdata/./etc/keys.properties' -> '/openhab/userdata/./etc/keys.properties'
openhab-1  | '/openhab/dist/userdata/./etc/keystore' -> '/openhab/userdata/./etc/keystore'
openhab-1  | '/openhab/dist/userdata/./etc/log4j2.xml' -> '/openhab/userdata/./etc/log4j2.xml'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.felix.eventadmin.impl.EventAdmin.cfg' -> '/openhab/userdata/./etc/org.apache.felix.eventadmin.impl.EventAdmin.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.felix.fileinstall-deploy.cfg' -> '/openhab/userdata/./etc/org.apache.felix.fileinstall-deploy.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.bundle.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.bundle.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.config.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.config.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.feature.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.feature.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.jaas.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.jaas.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.kar.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.kar.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.scope_bundle.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.scope_bundle.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.shell.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.shell.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.command.acl.system.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.system.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.features.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.features.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.features.repos.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.features.repos.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.features.xml' -> '/openhab/userdata/./etc/org.apache.karaf.features.xml'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.jaas.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.jaas.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.kar.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.kar.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.log.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.log.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.apache.karaf.shell.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.shell.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.jupnp.cfg' -> '/openhab/userdata/./etc/org.jupnp.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.openhab.audio.cfg' -> '/openhab/userdata/./etc/org.openhab.audio.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.openhab.voice.cfg' -> '/openhab/userdata/./etc/org.openhab.voice.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.ops4j.pax.logging.cfg' -> '/openhab/userdata/./etc/org.ops4j.pax.logging.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.ops4j.pax.url.mvn.cfg' -> '/openhab/userdata/./etc/org.ops4j.pax.url.mvn.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/org.ops4j.pax.web.cfg' -> '/openhab/userdata/./etc/org.ops4j.pax.web.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/overrides.properties' -> '/openhab/userdata/./etc/overrides.properties'
openhab-1  | '/openhab/dist/userdata/./etc/profile.cfg' -> '/openhab/userdata/./etc/profile.cfg'
openhab-1  | '/openhab/dist/userdata/./etc/scripts' -> '/openhab/userdata/./etc/scripts'
openhab-1  | '/openhab/dist/userdata/./etc/scripts/shell.colors.script' -> '/openhab/userdata/./etc/scripts/shell.colors.script'
openhab-1  | '/openhab/dist/userdata/./etc/scripts/shell.completion.script' -> '/openhab/userdata/./etc/scripts/shell.completion.script'
openhab-1  | '/openhab/dist/userdata/./etc/shell.init.script' -> '/openhab/userdata/./etc/shell.init.script'
openhab-1  | '/openhab/dist/userdata/./etc/startup.properties' -> '/openhab/userdata/./etc/startup.properties'
openhab-1  | '/openhab/dist/userdata/./etc/system.properties' -> '/openhab/userdata/./etc/system.properties'
openhab-1  | '/openhab/dist/userdata/./etc/users.properties' -> '/openhab/userdata/./etc/users.properties'
openhab-1  | '/openhab/dist/userdata/./etc/version.properties' -> '/openhab/userdata/./etc/version.properties'
openhab-1  | '/openhab/dist/userdata/./logs' -> '/openhab/userdata/./logs'
openhab-1  | '/openhab/dist/userdata/./logs/openhab.log' -> '/openhab/userdata/./logs/openhab.log'
openhab-1  | '/openhab/dist/userdata/./tmp' -> '/openhab/userdata/./tmp'
openhab-1  | '/openhab/dist/userdata/./tmp/README' -> '/openhab/userdata/./tmp/README'
openhab-1  | ++ cmp /openhab/userdata/etc/version.properties /openhab/dist/userdata/etc/version.properties
openhab-1  | + '[' '!' -z ']'
openhab-1  | + chown -R openhab:openhab /openhab
openhab-1  | + sync
openhab-1  | + '[' -d /etc/cont-init.d ']'
openhab-1  | + sync
openhab-1  | + '[' false == false ']'
openhab-1  | ++ IFS=' '
openhab-1  | ++ echo gosu openhab tini -s ./start.sh
openhab-1  | + '[' 'gosu openhab tini -s ./start.sh' == 'gosu openhab tini -s ./start.sh' ']'
openhab-1  | + command=($@ server)
openhab-1  | + exec gosu openhab tini -s ./start.sh server
openhab-1  | Launching the openHAB runtime...

In other window:

docker-host:/home/mynuc$ nc -vz localhost 8080
Connection to localhost (127.0.0.1) 8080 port [tcp/http-alt] succeeded!

If this doesn’t work for you, please post the output after you run “docker compose up”

Thanks for all the feedback.
I will give a update after installing a fresh new OS, Docker, Docker Desktop and Openhab were I will use things I learned from Ubuntu and the info given given by the Openhab team above.

I did some testing and can get it to work when using the docker form the app center. You can find the steps below.
On my Synology I was used to work with the GUI from docker but that is the part I can´t get to work.
I can install Docker Desktop and install Openhab as written below and see openhab in the GUI but accessing Openhab on port 8080 is not working. Does anyone have the procedure how to install Docker Desktop please share

Install ubuntu and the additional fixes

Install docker from App Center

Running Docker as nomal user
sudo addgroup --system docker
sudo adduser $USER docker
newgrp docker
	
sudo snap disable docker
	
sudo snap enable docker
	
Install openhab by creating the required directories

mkdir -p /home/mynuc/docker/openhab4.1.1/addons
mkdir -p /home/mynuc/docker/openhab4.1.1/conf
mkdir -p /home/mynuc/docker/openhab4.1.1/userdata

yaml docker compose plaatsen in docker directory
Create a file with name docker-compose.yml and add the following lines

services:
  openhab:
    image: "openhab/openhab:4.1.1"
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "/home/mynuc/docker/openhab4.1.1/addons:/openhab/addons"
      - "/home/mynuc/docker/openhab4.1.1/conf:/openhab/conf"
      - "/home/mynuc/docker/openhab4.1.1/userdata:/openhab/userdata"
    environment:
      CRYPTO_POLICY: "unlimited"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Amsterdam"
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"

Run docker compose up -d

Access openhab with localhost or ip address on port 8080.

Just glancing, I think these lines would be helpful. I wrote a lot in my above post, but to summarize, these lines are required.

Openhab itself is running fine. I can also edit the files from Windows.
Only a backup tar file I can’t get stored on my Synology.

I’m not sure that I understand the problem or the current state that you are in.

Are you able to connect via a web browser to the OpenHAB GUI by navigating to a link like

http://some-ip-here:8080

If yes, that’s great! Can you please elaborate on what the problem is with the backup tar file? What are you trying to do? I suspect that this is more of a Synology/Docker issue than an openhab issue.

If no, then you stated that “Openhab itself is running fine”. How did you determine that? Could you please provide the artifacts that can demonstrate that “Openhab itself is running fine”. Also, could you please post the output of your docker-compose up?

I finally have everything working as I wanted. This means Ubuntu, Docker, Openhab, access from windows and backup to synology. Thanks to the people who provided feedback on my questions.

If interested find below the steps I used

Install Ubuntu and the additional fixes (takes a few minutes before it popup)

  • Install docker from App Center

afbeelding

  • Running Docker as normal user
    sud add group --system docker
    sud adducer $USER docker
    newsgroup docker

sudo snap disable docker

sudo snap enable docker

  • Install openhab by creating the required directories
    mkdir -p /home/mynuc/docker/openhab4.1.1/addons
    mkdir -p /home/mynuc/docker/openhab4.1.1/conf
    mkdir -p /home/mynuc/docker/openhab4.1.1/userdata

  • Give the folder and the sub-folders al rights
    cd /home/mynuc/docker
    sudo chmod -R a+rwx .

  • Create yaml docker compose file
    cd /home/mynuc/docker
    nanu docker-compose.yml

  • Add the following lines

services:
openhab:
image: "openhab/openhab:4.1.1"
restart: always
network_mode: host
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
- "/home/mynuc/docker/openhab4.1.1/addons:/openhab/addons"
- "/home/mynuc/docker/openhab4.1.1/conf:/openhab/conf"
- "/home/mynuc/docker/openhab4.1.1/userdata:/openhab/userdata"
environment:
CRYPTO_POLICY: "unlimited"
EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Amsterdam"
OPENHAB_HTTP_PORT: "8080"
OPENHAB_HTTPS_PORT: "8443"
  • Run docker compose up -d

  • Check if you can access openhab with localhost and/or ip address on port 8080.

Share Openhab folders with Windows (I use VSC under windows)

  • Install samba
    sudo apt install samba

  • Configure samba what folder to share
    sudo nano /etc/samba/smb.conf
    The name between is the name popin-up in windows

[Docker_nuc]
path = /home/mynuc/docker
read only = No
guest ok = Yes
force user = mynuc
  • Restart the samba service
    sudo service smbd restart

  • Make it a network drive for windows
    sudo apt install wsdd

  • Check windows network
    You should be able to select the docker folder without login

  • I want to backup all the folders from Openhab in a tar file on Synology
    *The steps on Synology are straight forward

  • Map a shared folder from the Synology with the NUC
    You should see NAS. Select the first option and login with your Synology credentials.


  • Now you should see the NAS
    afbeelding

  • Install NFS
    sudo apt-get install nfs-common -y

  • Create a backup folder in the /srv folder. This seems to be important
    sudo mkdir /srv/backup_nas

  • Map both folders in a boot persistence way
    sudo nano /etc/fstab

192.168.100.51:/volume1/backup_nuc /srv/backup_nas      nfs     defaults        0       0
  • Reload the deamon
    systemctl -q daemon-reload

  • Mount the folder
    sudo mount -a

  • Create a backup script what you can use with crown
    Go to the docker folder
    cd /home/mynuc/docker
    Create the backup scripts file
    nanu backup.sh

echo "Backing up openhab 4.1.1"
file=/srv/backup_nas/openhab-$(date +%Y-%m-%d_%H%M).tgz
cd /home/mynuc/docker/openhab4.1.1
tar cfz $file .
  • Test the backup
    sudo bash /home/mynuc/docker/backup.sh
  • Change the rights to run it as root
    sudo chmod u+s backup.sh
  • Create a cron job for call the backup script file
    sudo crontab e
35 16 * * * sudo bash /home/mynuc/docker/backup.sh
  • Restart
    sudo systemctl restart cron
  • Check if the jobs work after time is expired with
    systemctl status cron
1 Like

Great news that you got everything working that you wanted, and thank you for posting your solution for the broader community.

FWIW

For those that have found this thread, I’d recommend following the process in the OpenHAB documentation here in order to get your openhab docker container up and running.

One thing the documentation does is to create a user and map that user in the docker container.

sudo useradd -r -s /sbin/nologin openhab
sudo usermod -a -G openhab openhab
sudo mkdir -p /opt/openhab/{conf,userdata,addons}
sudo chown -R openhab:openhab /opt/openhab

Users can note this in the docker run/compose.

     -e USER_ID=<uid> \
     -e GROUP_ID=<gid> \

Generally speaking:

running the above command is not recommended from a security perspective.

1 Like