Docker problem with /dev/ttyUSB serial paths

Hi there,

my docker container is not dealing well with the way Linux mount serial paths under /dev/ttyUSBX,
Problems:

  • USB device under /dev/ttyUSB0 have to be connected before docker starts, otherwise they wont exist.
  • Unplugging a device that was detect and properly mapped, does’t un-map the device, hence most serial-port libraries cannot determine it was disconnected and crashes.

Other things to notice:

  • lsusb finds the devices with no problems at all, regardless if they were connected before or after booting.
  • dmesg also detects the devices.

Relevant part of docker-compose
Noticed I am mapping the devices and also running as proviliged.
devices:
- “/dev/mem:/dev/mem”
- /dev/bus/usb:/dev/bus/usb:rwm
- /dev/ttyUSB0:/dev/ttyUSB0:rwm
- /dev/ttyUSB1:/dev/ttyUSB1:rwm
privileged: true
tty: true
volumes:
- /dev/bus/usb:/dev/bus/usb

My environment:

  • Docker 1.11 running on a RPI 3 (FROM resin/raspberrypi3-node:4.3)
  • USB Serial device: Arduino nano, but it happens with any USB peripheral.

$ docker-compose -v
docker-compose version 1.8.0, build 94f7016

$ docker -v
Docker version 1.11.1, build 5604cbe

$ uname -a
Linux dev-reefmate 4.4.11-v7+ #888 SMP Mon May 23 20:10:33 BST 2016 armv7l GNU/Linux