Open openhab karaf console on docker

Hello everyone,
I recently suffered from an SSD corruption on my home server, because of which I had to format my data drive.
I re-installed OpenHAB 4.1.1 on my unraid server using docker.
I was able to restore my previous openhab system by manually copying the backup files I used previously over the new openhab appdata docker folder, and the system mostly works well.

I do have two issues I can’t solve alone.

  1. I need to clear the pairings of the previously synced iOS Home app. For that I understand I need to run the clearPairing command, however, I don’t know how to open the karaf console when OpenHAB is installed as a docker app. Can someone please explain how to do it?

  2. The backup files I copied to the appdata openhab folder are now set to owner user root. Can someone explain how I can change the ownership to user openhab. the way it’s supposed to be?

Thank you for your help :pray:

see Default Karaf password in openHAB 3 Docker installation on Synology

shows the chown ( change owner ) command.

1 Like

Thank you very much, @Wolfgang_S ! :pray:
Using your explanation I was able to clear the homekit pairing :slight_smile:

However, I was not able to change the openhab directory ownership.
I’m not sure if the command I entered into terminal is correct.
My openhab docker directory is located in path /mnt/user/appdata/openhab
So if I understood correctly this is the command I entered in terminal and the error result I recieved:

root@Tower:~# sudo chown -R openhab:openhab /mnt/user/appdata/openhab
chown: invalid user: ‘openhab:openhab’

Was I supposed to do something else?

did you do this part first? create-the-openhab-user
The error you are getting is likely because it does not have a user named "openhab’. thus it is a “invalid user”

Thank you, @justaoldman and @Wolfgang_S :slight_smile: :pray:
You were both very helpful.
Now I managed to change the user:group of the directory to openhab :pray:
Many thanks to both of you :pray:

Few last questions.
Before I had to re-format my SSD drive and re-install the openhab docker app, I believe I ran openhab with a custom network type on port 8787.
However, now it will only work with network type Host and the dashboard only opens on port 8080 even though I set the http port in the docker configuration to 8787.
Is there a reason the docker app won’t work with the custom network and with port 8787?

Also, is there a difference which console shell command I use: shell or bash?

scroll down check out the environment variables you have configured for openhab.
Also pay close attention to what you have for your crypto policy level to address other issues may you run into or have with some bindings.
You have to tell openhab you want to use a different port to listen on.

EXTRA_JAVA_OPTS=""
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
OPENHAB_HTTP_PORT=8080
OPENHAB_HTTPS_PORT=8443
USER_ID=9001
GROUP_ID=9001
CRYPTO_POLICY=limited
By default the openHAB user in the container is running with:

uid=9001(openhab) gid=9001(openhab) groups=9001(openhab)

this link will discuss differences and limitations between running shell vs bash and may help you decide what you want to use.

Thank you.
In the unraid docker settings for the openhab container I don’t have an option to set:

OPENHAB_HTTP_PORT=8080
OPENHAB_HTTPS_PORT=8443

I assume I can change these ports using portainer, but I don’t know how to save the changes I make to the ports.
In the container settings for openhab in portainer I can see a duplicate/edit button, but after I change the ports numbers I don’t see a button to save the changes I made.
Do you, by chance, know how I can change the ports numbers and save them?

[Edit] Nevermind. I found and read the portainer documentation and was able to update the ports.

2 Likes