Docker - Anybody on a Windows Host Machine?

Hello,

I have succesfully set up openmhab in a docker. Runs smooth. Host system is Debian.

Now I want to set up my development system … on a Windows (10) Host.

I have docker running, everyting starts. I have a volume (mount) to the host. I change the configuration on the host to develop my system.

However, openhab does not load the modified item files.

I have a suspicion. Insider the Linux Container the owner of the /openhab/conf directory is root:root. This seems to be a problem when running on a windows host. Volumes mounted are owned by root. You cant chown them to a non-root user.

Anyone here in the docker/openhab community which runs docker on a windows host? WOuld love to get some hints were to search for … .

Regards
Ralf

What are the permissions of the files and folders owned by root:root inside the container?

What user is openHAB running as inside the container? It may make sense to go ahead and just run as root on Windows. The permissions structures between Windows and Linux are huge and I’m not surprised you would be seeing issues like this running on Windows. Running as root though should help deal with those sorts of issues.

I don’t normally recommend running as root, but in this case it might be the only way if you can’t change the ownership or permissions on the files.

Hello Rich,

thanks for jumping in here. Fullstory goes like this. Showcasing the rights issue with volumes when running on Windows docker host.

FROM multiarch/debian-debootstrap:amd64-stretch
RUN useradd -ms /bin/bash openhab -d /openhab/
RUN mkdir -p /openhab/conf
RUN chown -R openhab:openhab /openhab/*
USER openhab
WORKDIR /openhab
RUN touch /openhab/conf/test
VOLUME /openhab/conf
RUN echo 'alias ll="ls -l"' >> /openhab/.bashrc
ENTRYPOINT [ "/bin/bash" ]

Lets start the docker and look what the owner of the files in /opt/openhab/*is.

docker build -t test .
docker run -ti test

Inside the docker we do

openhab@21281670182a:/openhab$ ll conf
total 0
-rw-r--r-- 1 openhab openhab 0 Jan 14 05:38 test

Now lets restart, connect a volume and do the same

docker run -v c:\\Users\\rak\\Documents\\MySource\\openhab\\docker\\test:/openhab/conf -ti test

Inside the docker we do

openhab@bf563d769f03:/openhab$ ll conf
total 5
-rwxr-xr-x 1 root root 319 Jan 14 05:38 Dockerfile
-rwxr-xr-x 1 root root 43 Jan 14 05:32 readme.md

Now the files are owned by root. Even the original folder is owned by root

openhab@bf563d769f03:/openhab$ ll -d conf
drwxrwxrwx 2 root root 0 Jan 14 05:28 conf

What would need to be done to run openhab/openhab under root. Is it adding a USER root?

Security risk should not be a problem, bc this is my test/dev setup on one PC havinf ETS5, docker and openhab running while on the road. It will not run continioulsy.

Production runs on ubuntu 18.04.

Regards
Ralf

I think it is indeed as simple as setting USER root like you say. If not follow the User and Group section on the DockerHub page for openHAB’s image and set the UID/GUI to root’s.

It’s a long shot, but you might be able to run docker inside a WSL which might deal with these permission problems. Probably not but it could be worth at least a google search.