The simple solution would be to use the --privileged flag which gives that specific container root rights. However I understand that this is sometimes not ideal for all use-cases.
Did a Torizon: Rebuild SDK and reload in container. But still got the error. So I connected over SSH and run the following command:
apalis-imx8-06494488:~$ docker inspect --format=‘{{.HostConfig.Privileged}}’ 851b6244…
false
It seems that this didn’t worked. I am really a beginner when it comes to Docker
The json file you modified is for the development container which builds the application not for the application container that runs your code. Please do not modify this file as it can cause your project to work unpredictably.
To modify your application container you need to use the configuration panel provided by the Torizon extension. For any generic docker configuration you can use the extraparms option. For --privileged you need to pass a key/value pair of privileged and True.
Alternatively, you can also set the the project’s username to root instead of torizon. Which effectively gives the container root privileges as well. This is shown here with our article on using CAN: How to Use CAN on TorizonCore | Toradex Developer Center
Since using the CAN bus properly also requires root privileges.
Only privileged flag was not enough but setting the user to root it works. Thank you very much Jeremias. It’s still a long way to go to understand all this with the VSC, Docker and Torizon. Next piece of the puzzle solved.