[SOLVED] OH2 in Docker on openmediavault, no acess to OH2 GUI

Hello openHAB friends,

I am Using a Raspberry Pi 3+ with openhabian. I got an 2nd Raspberry Pi 3+ with openmediavault as an networkstorage installed. Now I try to combine this to machines, with the help from docker in openmediavault.

But I can’t connect to the openhab GUI over :8080 and the docker is restarting all the time. In my dictionary for the docker, he created the item, sitemap, etc folder.

This is how I “installed” it:

Installed docker in openmediavault and downloaded openhab 2 over the GUI from dockerhub (https://hub.docker.com/r/openhab/openhab/).

I sat up the openhab docker with settings from the dockerhub site:

services:
  openhab:
    image: "openhab/openhab:2.4.0"
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "./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"

in openmediavault docker config for openhab2:

Did I am missing something? Can I use the Port 8080 for this?

Greeting

It looks like you’re using the same directory for all three volumes? That won’t work. They should all be different directories. Using spaces in volume paths is also asking for issues. :wink: There will also be logging telling exactly what the issue is.

1 Like

Thanks! So simple… :wink:

The last logging was:

Launching the openHAB runtime...

Great! If it got that far, it will probably have logged something in the application logs in userdata/logs.
You can also add a console logger to the logging configuration. That way the application logging will show up in the Docker container logs, see:

Thanks, but me problem at the moment is, that I can’t edit the files in the shared folder on my storage, I need the rights for Unix User\9001. Can I use this over shh?:

I am new at docker, I don’t know so much over the linking from one docker to the other one.

Using those commands over ssh you could create that openhab user.

You can also change the user/group of those files by providing the container the USER_ID and GROUP_ID of an existing user using the environment variables. These can be obtained by logging in as that user and executing the id command:

$ id
uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lxd),115(lpadmin),116(sambashare),999(docker)

Is that a must or is it a possibility? Or I need both?

Do I have to use this command in the docker or in the normal SSH environment?

One of the two ways is enough. Only if you create a new user with different UID/GID than 9001 you need both. A third way is to prefix any commands to read/modify those files with sudo so you execute the commands as super user.

These environment variables are passed to the container when you start it. I think it should work if you add those as new entries to the “Umgebungsvariablen” list in the screenshot.

Thanks! Now I can edit the folder. I used this over ssh:

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

But now I want to edit my files with VScode. I know I need to open the port 5007. Did I need a new user too or can I edit the configfile of VScode to my myownuser and myownpassword?

And one thing, I created on my openHAB-Raspberry an openHAB-Backup over:

sudo $OPENHAB_RUNTIME/bin/backup

and copied this .zip on my pc.

Can I use the restore command and the backup folder to load this backup?

sudo $OPENHAB_RUNTIME/bin/restore $OPENHAB_BACKUPS/myBackup.zip

and thanks again, you’re great!

Port 5007 is the LSP port used by VS Code for content assist for rules and syntax validation. VS Code will also need to access to the actual files using some network sharing protocol (samba, nfs or sshfs). So if myownuser is in the openhab group it should be possible to edit them using VS Code and network sharing. See also the Network Sharing documentation.

It will probably work if the machine uses OH with the same directory layout. There are files in the userdata dir that have an absolute reference to the installation location of openHAB in the container in /openhab/ . So these might need to be updated or if you restore the backup on Linux/Unix creating a symlink from /openhab/ to the actual dir might also resolve it.

See also: