Openhab in Linux container on WIndows Docker won't start

I’m trying to run the official openHAB 2.4 Docker Image in a Linux container in Docker on Windows 10. The container itself starts, creates all the files in the mounted volumes, but hangs at Launching the openHAB runtime...

I tried this on 2 different Windows 10 machines and even waited for hours.

This is my docker-compose.yml

openhab:
    container_name: "openhab"
    image: "openhab/openhab:2.4.0"
    restart: always
    network_mode: host
    volumes:
      - "./openhab/addons:/openhab/addons"
      - "./openhab/conf:/openhab/conf"
      - "./openhab/userdata:/openhab/userdata"
    environment:
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"

Here is the log from Docker:

++ test -t 0
++ echo false
+ interactive=false
+ set -euo pipefail
+ IFS='
        '
+ '[' limited = unlimited ']'
+ rm -f /openhab/runtime/instances/instance.properties
+ rm -f /openhab/userdata/tmp/instances/instance.properties
+ NEW_USER_ID=9001
+ NEW_GROUP_ID=9001
+ echo 'Starting with openhab user id: 9001 and group id: 9001'
Starting with openhab user id: 9001 and group id: 9001
+ id -u openhab
++ getent group 9001
+ '[' -z '' ']'
+ echo 'Create group openhab with id 9001'
+ groupadd -g 9001 openhab
Create group openhab with id 9001
+ echo 'Create user openhab with id 9001'
+ adduser -u 9001 --disabled-password --gecos '' --home /openhab --gid 9001 openhab
Create user openhab with id 9001
Warning: The home dir /openhab you specified already exists.
Adding user `openhab' ...
Adding new user `openhab' (9001) with group `openhab' ...
adduser: Warning: The home directory `/openhab' does not belong to the user you are currently creating.
The home directory `/openhab' already exists.  Not copying from `/etc/skel'.
+ groupadd -g 14 uucp2
+ groupadd -g 16 dialout2
+ groupadd -g 18 dialout3
+ groupadd -g 32 uucp3
+ groupadd -g 997 gpio
+ adduser openhab dialout
Adding user `openhab' to group `dialout' ...
Adding user openhab to group dialout
Done.
+ adduser openhab uucp
Adding user `openhab' to group `uucp' ...
Adding user openhab to group uucp
Done.
+ adduser openhab uucp2
Adding user `openhab' to group `uucp2' ...
Adding user openhab to group uucp2
Done.
+ adduser openhab dialout2
Adding user `openhab' to group `dialout2' ...
Adding user openhab to group dialout2
Done.
+ adduser openhab dialout3
Adding user `openhab' to group `dialout3' ...
Adding user openhab to group dialout3
Done.
+ adduser openhab uucp3
Adding user `openhab' to group `uucp3' ...
Adding user openhab to group uucp3
Done.
+ adduser openhab gpio
Adding user `openhab' to group `gpio' ...
Adding user openhab to group gpio
Done.
+ case ${OPENHAB_VERSION} in
++ ls -A /openhab/userdata
+ '[' -z '' ']'
+ echo 'No userdata found... initializing.'
No userdata found... initializing.
+ cp -av /openhab/userdata.dist/. /openhab/userdata/
'/openhab/userdata.dist/./etc' -> '/openhab/userdata/./etc'
'/openhab/userdata.dist/./etc/all.policy' -> '/openhab/userdata/./etc/all.policy'
'/openhab/userdata.dist/./etc/branding-ssh.properties' -> '/openhab/userdata/./etc/branding-ssh.properties'
'/openhab/userdata.dist/./etc/branding.properties' -> '/openhab/userdata/./etc/branding.properties'
'/openhab/userdata.dist/./etc/com.eclipsesource.jaxrs.connector.cfg' -> '/openhab/userdata/./etc/com.eclipsesource.jaxrs.connector.cfg'
'/openhab/userdata.dist/./etc/com.eclipsesource.jaxrs.swagger.config.cfg' -> '/openhab/userdata/./etc/com.eclipsesource.jaxrs.swagger.config.cfg'
'/openhab/userdata.dist/./etc/config.properties' -> '/openhab/userdata/./etc/config.properties'
'/openhab/userdata.dist/./etc/custom.properties' -> '/openhab/userdata/./etc/custom.properties'
'/openhab/userdata.dist/./etc/custom.system.properties' -> '/openhab/userdata/./etc/custom.system.properties'
'/openhab/userdata.dist/./etc/distribution.info' -> '/openhab/userdata/./etc/distribution.info'
'/openhab/userdata.dist/./etc/equinox-debug.properties' -> '/openhab/userdata/./etc/equinox-debug.properties'
'/openhab/userdata.dist/./etc/java.util.logging.properties' -> '/openhab/userdata/./etc/java.util.logging.properties'
'/openhab/userdata.dist/./etc/jmx.acl.org.apache.karaf.bundle.cfg' -> '/openhab/userdata/./etc/jmx.acl.org.apache.karaf.bundle.cfg'
'/openhab/userdata.dist/./etc/jmx.acl.org.apache.karaf.config.cfg' -> '/openhab/userdata/./etc/jmx.acl.org.apache.karaf.config.cfg'
'/openhab/userdata.dist/./etc/jre.properties' -> '/openhab/userdata/./etc/jre.properties'
'/openhab/userdata.dist/./etc/keys.properties' -> '/openhab/userdata/./etc/keys.properties'
'/openhab/userdata.dist/./etc/keystore' -> '/openhab/userdata/./etc/keystore'
'/openhab/userdata.dist/./etc/org.apache.felix.eventadmin.impl.EventAdmin.cfg' -> '/openhab/userdata/./etc/org.apache.felix.eventadmin.impl.EventAdmin.cfg'
'/openhab/userdata.dist/./etc/org.apache.felix.fileinstall-deploy.cfg' -> '/openhab/userdata/./etc/org.apache.felix.fileinstall-deploy.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.command.acl.bundle.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.bundle.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.command.acl.config.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.config.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.command.acl.feature.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.feature.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.command.acl.jaas.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.jaas.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.command.acl.kar.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.kar.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.command.acl.scope_bundle.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.scope_bundle.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.command.acl.shell.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.shell.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.command.acl.system.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.command.acl.system.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.features.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.features.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.features.repos.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.features.repos.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.jaas.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.jaas.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.kar.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.kar.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.log.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.log.cfg'
'/openhab/userdata.dist/./etc/org.apache.karaf.shell.cfg' -> '/openhab/userdata/./etc/org.apache.karaf.shell.cfg'
'/openhab/userdata.dist/./etc/org.eclipse.smarthome.audio.cfg' -> '/openhab/userdata/./etc/org.eclipse.smarthome.audio.cfg'
'/openhab/userdata.dist/./etc/org.eclipse.smarthome.voice.cfg' -> '/openhab/userdata/./etc/org.eclipse.smarthome.voice.cfg'
'/openhab/userdata.dist/./etc/org.jupnp.cfg' -> '/openhab/userdata/./etc/org.jupnp.cfg'
'/openhab/userdata.dist/./etc/org.ops4j.pax.logging.cfg' -> '/openhab/userdata/./etc/org.ops4j.pax.logging.cfg'
'/openhab/userdata.dist/./etc/org.ops4j.pax.url.mvn.cfg' -> '/openhab/userdata/./etc/org.ops4j.pax.url.mvn.cfg'
'/openhab/userdata.dist/./etc/org.ops4j.pax.web.cfg' -> '/openhab/userdata/./etc/org.ops4j.pax.web.cfg'
'/openhab/userdata.dist/./etc/overrides.properties' -> '/openhab/userdata/./etc/overrides.properties'
'/openhab/userdata.dist/./etc/profile.cfg' -> '/openhab/userdata/./etc/profile.cfg'
'/openhab/userdata.dist/./etc/scripts' -> '/openhab/userdata/./etc/scripts'
'/openhab/userdata.dist/./etc/scripts/shell.colors.script' -> '/openhab/userdata/./etc/scripts/shell.colors.script'
'/openhab/userdata.dist/./etc/scripts/shell.completion.script' -> '/openhab/userdata/./etc/scripts/shell.completion.script'
'/openhab/userdata.dist/./etc/shell.init.script' -> '/openhab/userdata/./etc/shell.init.script'
'/openhab/userdata.dist/./etc/startup.properties' -> '/openhab/userdata/./etc/startup.properties'
'/openhab/userdata.dist/./etc/system.properties' -> '/openhab/userdata/./etc/system.properties'
'/openhab/userdata.dist/./etc/users.properties' -> '/openhab/userdata/./etc/users.properties'
'/openhab/userdata.dist/./etc/version.properties' -> '/openhab/userdata/./etc/version.properties'
'/openhab/userdata.dist/./logs' -> '/openhab/userdata/./logs'
'/openhab/userdata.dist/./logs/openhab.log' -> '/openhab/userdata/./logs/openhab.log'
'/openhab/userdata.dist/./tmp' -> '/openhab/userdata/./tmp'
'/openhab/userdata.dist/./tmp/README' -> '/openhab/userdata/./tmp/README'
++ cmp /openhab/userdata/etc/version.properties /openhab/userdata.dist/etc/version.properties
+ '[' '!' -z ']'
++ ls -A /openhab/conf
+ '[' -z '' ']'
+ echo 'No configuration found... initializing.'
No configuration found... initializing.
+ cp -av /openhab/conf.dist/. /openhab/conf/
'/openhab/conf.dist/./html' -> '/openhab/conf/./html'
'/openhab/conf.dist/./html/index.html' -> '/openhab/conf/./html/index.html'
'/openhab/conf.dist/./html/readme.txt' -> '/openhab/conf/./html/readme.txt'
'/openhab/conf.dist/./icons' -> '/openhab/conf/./icons'
'/openhab/conf.dist/./icons/classic' -> '/openhab/conf/./icons/classic'
'/openhab/conf.dist/./icons/classic/readme.txt' -> '/openhab/conf/./icons/classic/readme.txt'
'/openhab/conf.dist/./items' -> '/openhab/conf/./items'
'/openhab/conf.dist/./items/readme.txt' -> '/openhab/conf/./items/readme.txt'
'/openhab/conf.dist/./persistence' -> '/openhab/conf/./persistence'
'/openhab/conf.dist/./persistence/readme.txt' -> '/openhab/conf/./persistence/readme.txt'
'/openhab/conf.dist/./rules' -> '/openhab/conf/./rules'
'/openhab/conf.dist/./rules/readme.txt' -> '/openhab/conf/./rules/readme.txt'
'/openhab/conf.dist/./scripts' -> '/openhab/conf/./scripts'
'/openhab/conf.dist/./scripts/readme.txt' -> '/openhab/conf/./scripts/readme.txt'
'/openhab/conf.dist/./services' -> '/openhab/conf/./services'
'/openhab/conf.dist/./services/addons.cfg' -> '/openhab/conf/./services/addons.cfg'
'/openhab/conf.dist/./services/readme.txt' -> '/openhab/conf/./services/readme.txt'
'/openhab/conf.dist/./services/runtime.cfg' -> '/openhab/conf/./services/runtime.cfg'
'/openhab/conf.dist/./sitemaps' -> '/openhab/conf/./sitemaps'
'/openhab/conf.dist/./sitemaps/readme.txt' -> '/openhab/conf/./sitemaps/readme.txt'
'/openhab/conf.dist/./sounds' -> '/openhab/conf/./sounds'
'/openhab/conf.dist/./sounds/barking.mp3' -> '/openhab/conf/./sounds/barking.mp3'
'/openhab/conf.dist/./sounds/doorbell.mp3' -> '/openhab/conf/./sounds/doorbell.mp3'
'/openhab/conf.dist/./things' -> '/openhab/conf/./things'
'/openhab/conf.dist/./things/readme.txt' -> '/openhab/conf/./things/readme.txt'
'/openhab/conf.dist/./transform' -> '/openhab/conf/./transform'
'/openhab/conf.dist/./transform/de.map' -> '/openhab/conf/./transform/de.map'
'/openhab/conf.dist/./transform/en.map' -> '/openhab/conf/./transform/en.map'
'/openhab/conf.dist/./transform/readme.txt' -> '/openhab/conf/./transform/readme.txt'
+ chown -R openhab:openhab /openhab
+ sync
+ '[' -d /etc/cont-init.d ']'
+ sync
+ '[' false == false ']'
++ IFS=' '
++ echo gosu openhab tini -s ./start.sh
+ '[' 'gosu openhab tini -s ./start.sh' == 'gosu openhab tini -s ./start.sh' ']'
+ command=($@ server)
+ exec gosu openhab tini -s ./start.sh server
Launching the openHAB runtime...

It won’t show any additional logging unless you configure a console logger or start it with an interactive console.

See:

It will still log many interesting details in the log files in: userdata/logs :slight_smile:

This is the content of openhab.log. The Other logfiles in that folder are empty.

2019-08-08 23:19:25.680 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 172.18.0.1

2019-08-08 23:19:25.686 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 192.168.65.3

2019-08-08 23:19:25.686 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 10.0.75.2

2019-08-08 23:19:26.383 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://10.1.0.1:8080

2019-08-08 23:19:26.384 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://10.1.0.1:8443

2019-08-08 23:19:27.355 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007

2019-08-10 19:40:54.464 [INFO ] [.dashboard.internal.DashboardService] - Stopped Dashboard

2019-08-10 19:42:02.713 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 172.18.0.1

2019-08-10 19:42:02.719 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 192.168.65.3

2019-08-10 19:42:02.720 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 10.0.75.2

2019-08-10 19:42:06.221 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 172.18.0.1

2019-08-10 19:42:06.233 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 192.168.65.3

2019-08-10 19:42:06.233 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring 10.0.75.2

2019-08-10 19:42:09.634 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007

2019-08-10 19:42:10.637 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://10.1.0.1:8080

2019-08-10 19:42:10.638 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://10.1.0.1:8443

That logging looks all normal. I haven’t used Docker on Windows 10 myself, but according to this Docker tutorial host networking might not work on Windows/Mac:

The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.

So you could try removing network_mode: host from your compose file and add a section for mapping the ports instead:

      ports:
        - 8080:8080
        - 8443:8443

So it should be similar to this example though using the default port numbers:

openhab:
    container_name: "openhab"
    image: "openhab/openhab:2.4.0"
    restart: always
    ports:
      - 8080:8080
      - 8443:8443
    volumes:
      - "./openhab/addons:/openhab/addons"
      - "./openhab/conf:/openhab/conf"
      - "./openhab/userdata:/openhab/userdata"
    environment:
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"

That worked, thanks :smiley:

1 Like

That’s awesome! :slightly_smiling_face:

I still wanted to test the containers on Windows myself too one day to see if and how it works.

Since it now works, I’ve added a section about running the containers on Windows/macOS with these details to the container documentation.