How can I run "docker run --device" command?

Hi, I’m trying resin.io with an Intel Edison board.
I have a nodejs example, reading data from an usb dongle with serialport module,
After “git push resin master”, the server will automatically build image for me and
start the container. How can I do something equivalent to “docker run --device” before
starting a container.

Containers on your device run with --privileged by default so you won’t need to specifically allow a device. The reason behind that is that in an IoT context you usually want to interface with the hardware instead of being isolated in a pure namespaced environment.

Thanks for your reply, but I am still confused.

In my nodejs example, I can open serailport with the path: ‘/dev/ttyUSB0’ on RPi2 before.
Now I use Web Terminal to access container, but I can not find the same path on Edison.
But, I can see a usb device with the ‘lsusb’ command when I plug/unplug it. How can I
find the correct usb path on Edison for the node serialport module, and open it?

Thank you very much.

Hi, what kind of breakboard are you using for your edison?

Hi florin,
I’m using INTEL® EDISON AND ARDUINO BREAKOUT KIT

Hi, can you make sure the edison is set to usb host mode?

There should be a SW1 slider that you can use to set your edison in either host mode or device mode.
When the slider is switched towards the USB standard size Type A connector, the Edison board will go to host mode. When the switch is towards the micro USB Type B connector, the Edison board will go to device mode.

This requires that you use an external power adapter too.

Also please see http://docs.resin.io/#/pages/hardware/i2c-and-spi.md#edison-in-usb-host-mode

Thank you,
Florin

Hi florin,

Im sure my edison is set to host mode. My usb dongle has a led on it,
only host mode the dongle can get power and the led will blink.

Okay, that seems right.

Did you also do as instructed here? http://docs.resin.io/#/pages/hardware/i2c-and-spi.md#edison-in-usb-host-mode