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


#1

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.


#2

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.


#3

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.


#4

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


#5

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


#6

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


#7

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.


#8

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