Openhab in Docker vs Manual installation

  • Platform information:
    • Hardware: amd 2700x 32 gb ram
    • OS: Ubuntu ( Manual) Debian (inside docker)
    • Java Runtime Environment: zulu8 in both
  • Issue of the topic:
    I use openhab manually installed. I used it to send data ( Echocontrol LastvoiceCommand Channel ( items) ) outside to feed my HomeSeer install via mqtt.

I just tried The very same config with docker by curiosity. I am new to docker, but I can say that it is the only container/ image ( I have 4) that is slow to send data outside.

So data is not slow without Docker, but with docker it is slow. This is trange because i did set up the docker as host? And do not forward anything.

here is my docker run ‘‘script’’
docker run \ --name=openhab \ --net=host \ -h 127.0.0.1 \ --restart=always \ -v /etc/localtime:/etc/localtime:ro \ -v /etc/timezone:/etc/timezone:ro \ -v /opt/openhab/addons:/openhab/addons \ -v /opt/openhab/conf:/openhab/conf \ -v /opt/openhab/userdata:/openhab/userdata \ -e "EXTRA_JAVA_OPTS=-Duser.timezone=America/Toronto" \ -d \ -e USER_ID=Hidden \ -e GROUP_ID=Hidden \ openhab/openhab:latest

Maybe i missed something in the config?

Finally, I went back to my manual install , and all is going fast.

So I do not know if the data is slow to enter the docker container, Or if is is slow to send data outside via mqtt.

Thanks

You need to elaborate more on “slow” and “fast”. There really isn’t anything specific to Docker that would cause messages to be delayed. Especially when you run with --net=host there is literally nothing between the Docker container and the hardware (unlike a VM). All a container is is a label in the Linux kernel that causes the Linux kernel to keep the container’s processes and access to stuff isolated. There should be no CPU or networking different between a process running in Docker and natively. So the problem has to be something about the configuration of OH inside the container that is making it slow.

Is the process pegging the CPU? Is OH receiving the message but slow to process it? Do you see errors in the logs?

2 Likes

Thanks for you reply. This was a dns issue. With the setup manually installed the dns was resolving a lot more
 but sometime not to
 and i didn’t realize it.
The problem is that it is impossible to edit the dns file, there are simlinks everywhere ( i think this is when i went from ifup package to netplan.
Until I find the issue. i will run docker since i can specify directly the dns i want to use . 


It works perfectly with this docker setting

    `docker run \
    --name=openhab \
    --net=host \
    --dns=192.168.x.x \
    --restart=always \
    -v /etc/localtime:/etc/localtime:ro \
    -v /etc/timezone:/etc/timezone:ro \
    -v /opt/openhab/addons:/openhab/addons \
    -v /opt/openhab/conf:/openhab/conf \
    -v /opt/openhab/userdata:/openhab/userdata \
    -e "EXTRA_JAVA_OPTS=-Duser.timezone=America/Toronto" \
    -d \
    -e USER_ID=xxxx \
    -e GROUP_ID=xxxxxx \
    openhab/openhab:latest`
1 Like

What I mean by slow : I was usewd to receive the imput from openhab instamntly. But it was taking sometimes 3-4 second
 to receive the command.

Basically openhab wasn’t able to resolve anything dns related , and had to rely on something else on the system.