Exec under docker

Hello,
I’m trying to move my openhab to docker, and having problem with the exec binding.
I’ve mounted volume to directory with jar to run some logic and exec some logic.
In my raspberry the logic works great, in the docker I don’t see any errors in the log but the process not run… (no mq update) if I’m running it inside the docker (login to the container using bash) it is working…
any ideas why?

Thanks ahead.

Since you can run it from bash inside the container then follow How to solve Exec binding problems.

One thing to note is when you run docker exec -it openhab /bin/bash you get a shell as root, not the openhab user.

I’ve tried, the echo command is working great… but still the java run program not running, the result of the exec is null…
I’ve tried to specific the location…
this is the command:
executeCommandLine("/usr/bin/java@@-jar@@/home/me/calc-mqtt.jar",60000)

Does it take longer than a minute to run normally?

Does it take longer than a minute for the call to executeCommandLine to run or does it return immediately?

What are the permissions on the jar file?

I’ve only ever seen executeCommandLine return null when the command didn’t finish before the timeout.

Now I see its permissions issues.
but as far as I see:
result is: Error: Unable to access jarfile /home/me/calc-mqtt.jar

how can I set permission to the file? the permissions is:
-rwxrwxrwx 1 9001 9001

It might be the case that Docker will not allow you to execute a file mapped into the container. I don’t know if that is the case but if it is that would be an awesome security feature.

I’ve found out the problem.
I had to login into the container and add permissions to /home/me directory…
I don’t understand why since I set the permission of the directory from the docker machine to 777…
any way to change it already when I’m creates the docker?
(using docker run command?)

You would have to rebuild the container to make the change when the image is created or modify the entrypoin.sh script to do it for you. Both require modifications to the Dockerfile.