Dear all!
I want to move my OH installation from a dedicated Raspberry Pi to an already running x64 debian server (that already runs various things like samba, postfix, dovecot, tvheadend, oscam, dlna…).
On my debian 12 bookworm I installed docker and tried to get the openhab up and running according to
https://www.openhab.org/docs/installation/docker.html
and
https://hub.docker.com/r/openhab/openhab/
My starting command is:
sudo docker run \
--name openhab \
--net=host \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
-v /srv/docker/openhab/conf:/openhab/conf \
-v /srv/docker/openhab/userdata:/openhab/userdata \
-v /srv/docker/openhab/addons:/openhab/addons \
-d \
-e USER_ID=998 \
-e GROUP_ID=997 \
-e CRYPTO_POLICY=unlimited \
--restart=always \
openhab/openhab:latest-debian
but the docker image starts “unhealthy”, as
sudo docker ps -a
tells me.
A quick look into the logfile
/srv/docker/openhab/userdata/logs/openhab.log
reveals:
2024-05-13 12:50:06.625 [ERROR] [j.pax.web.service.internal.Activator] - Unable to start Pax Web server: Failed to bind to /0.0.0.0:8080
Caused by: java.net.BindException: Address already in use
2024-05-13 12:50:08.870 [WARN ] [org.openhab.core.net.NetUtil ] - Found multiple local interfaces - ignoring 192.168.8.2
That IP 192.168.8.2 is the (external) IP of my debian server on the intranet.
This will most likely be due to the fact that this same debian machine is already running a docker image of pihole that also happens to listen to port 8080 (ie to 192.168.8.2:8080).
As a note, the openhab docker container does not answer sensibly on https port 8443 either.
Now, forgive me, I am not a docker expert, but as the installation instruction in
https://www.openhab.org/docs/installation/docker.html
says, the option
--net=host
should make the specification of port mapping obsolete, and indeed, if i specify
-p 8081 \
in the startup command this gets ignored:
WARNING: Published ports are discarded when using host network mode
.
However, me thinks I don’t understand the net=host option sufficiently, I still have a feeling that I should remap the conflicting ports between pihole and openhab, but I don’t really know how to specify this correctly in the docker run command.
Which ports would I have to map to get all openhab components working, ie Log-Page, MainUI (I think MainUI uses 8080), Sitemaps, Samba-Shares, persistence-services…
I think I could also use a different port for the webinterface of the pihole image, actually I already map the ports external-8080 to pihole-80 (in the pihole yml file), I could just map external-8081 to pihole-80 and leave external-8080 to openhab-8080?
Thanx,
Sulla