Openhab on a Mac with docker not working

To set up a convenient test/preprod/dev system I wanted to install openhab in a docker container on my Mac. I followed the guidelines in but it won’t work on my Mac.
in the logs I find permission errors like

cp: cannot create directory '/openhab/userdata/./etc': Permission denied
cp: cannot create directory '/openhab/userdata/./logs': Permission denied

but I exported the correct id’s that are on my Mac which I found using
id openhab
result in
uid=502(openhab) gid=20(staff) groups=20(staff),503(openhab),12(everyone),61(localaccounts),703(,100(_lpoperator),701(,702(

so I start the container with

docker run \
        --name openhab \
        --net=host \
        -v /opt/openhab/conf:/openhab/conf \
        -v /opt/openhab/userdata:/openhab/userdata \
        -v /opt/openhab/addons:/openhab/addons\
        -d \
        -e USER_ID=502 \
        -e GROUP_ID=503 \

also with sudo docker … doesn’t work
And yes… in the docker preferences I exported the /opt/openhab directory and the permissions seem correct as can be seen here

drwxr-xr-x  2 openhab  openhab  64 26 Jul 17:36 addons
drwxr-xr-x  2 openhab  openhab  64 26 Jul 17:36 conf
drwxr-xr-x  2 openhab  openhab  64 26 Jul 17:36 userdata

Any idea?

Hm. Nonne able to help me?

OpenHAB requires the Docker container to use the host network. In your case that’s your Mac’s network setup. Therefore the --net=host option is added.

But this option is not supported on 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 that means you can’t use openHAB in a docket container?

You can. But on Windows or Mac, you should remove --net=host \ and add -p 8080:8080 \.

The only constraint is that UPnP for discovery is not working.

That’s right! This information is also in the openHAB container documentation nowadays.


It seems like many people ignore it unless it is a Youtube video :frowning: