Many devices not in /dev for release

the devices in /dev when I log into putty is very different when I run a docker image; (there is almost nothing in /dev)
torizon@5d7d0a6aacf9:/TestDevices/bin$ ls /dev
console fd full mqueue null ptmx pts random shm stderr stdin stdout tty urandom zero

I have written some C/C++ test code to access devices like gpio, i2c, usb, ttyACM0, they’re all working under VSCode, but I wanted to try it on the release image under putty terminal. not debug image.
so I build and deploy the release container, but I found out that there are almost no devices in /dev.
no gpiochipx, i2c-x, usb, ttyACM0, so the test app can’t find those devices.

So since the VSCode just runs the container and works, why it can’t work when running the release container in putty terminal? isn’t that the point of using docker images(everything will work)?

I

Greetings @swc,

What I imagine is happening is that you’re simply executing the container via terminal without any of the needed arguments.

Keep in mind in VSCode you had to add various options to the configuration panel to allow use of the various hardware subsystems. These options affect how the container is being executed by VSCode.

For example see here this article on how to use I2C with Torizon and containers: How to use I2C on Torizon | Toradex Developer Center

When executing from the terminal, you need to add various arguments to your docker run command to allow access to interfaces present on the host. Our VSCode extension abstracts this detail as long as you add the appropriate configuration.

What might help it that our VSCode extensions should have a command like Torizon: Export Docker command line or something similar. This will output the exact docker run command that our extension uses to launch the container as well as all of the arguments used.

The quick and dirty option would be to just bind mount all of /dev inside the container but. But then you would have every /dev entry accessible inside the container which may not be desirable due to security reasons. But this depends on use-case.

I hope I helped clarify the situation. Let me know if you have any further questions.

Best Regards,
Jeremias

that works. I guess I’m still learning and didn’t realized what is in the image and what is not.(settings)

Glad I could help clear things up!