Docker Community Forums

Share and learn in the Docker community.

Lock serial port in container

(Heitorprojects) #1

Unlike with a VM, serial ports mapped to a container (ex: --device /dev/ttyS0) remain unlocked and accessible from both the host and the container (ex: echo "I'm unlocked." > /dev/ttyS0 - will print to a connected printer when the command is issued from both the container and the host).

Trying to use JavaPOS, fails because the Java Comm implementation tries to ‘lock’ the serial port, to provide exclusive access to the connected device, to a single application.

How can I lock the device exclusively for access in the container? (much like a VM does…), and allow the communication service in the container to ‘exclusively claim’ the device?