usb serial devices in docker container

Discussion in 'Linux Virtual Machine' started by BernhardB7, Jan 17, 2023.

  1. BernhardB7

    BernhardB7 Bit poster

    How can I access usb devices connected to my Mac from within a docker container (e.g. as /dev/ttyACM0)?

    My setup:
    1. Removed official Docker Desktop
    2. Installed docker-machine per instructions at
    3. Made USB device available in `pal-dev` virtual machine
    4. On Mac, ran `docker run --rm -it -v `pwd`:/app --privileged ubuntu bash`
    5. From the bash prompt (in the ubuntu container): `ls /dev` - my usb serial device is not present.
    Output from `lsusb` shows the device (Embassy USB-serial logger):
    Bus 001 Device 007: ID 045e:007e Microsoft Corp. Wireless Transceiver for Bluetooth​
    Bus 001 Device 009: ID 203a:fff9 PARALLELS FaceTime HD Camera (Built-in)
    Bus 001 Device 008: ID 203a:fffc PARALLELS Virtual Mouse
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 019: ID c0de:cafe Embassy USB-serial logger
    Bus 002 Device 018: ID 203a:fffe PARALLELS Virtual USB1.1 HUB
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

    I've also tried an Ubuntu VM hosted by Parallels - it has access to the usb device.
    Background: Lack of support for usb passthrough is a known limitation of Docker Desktop. I hope to use Parallels as an alternative that has this capability. Getting the device to show up in `/dev` is the stumbling block.

  2. NikolaiS@Parallels

    NikolaiS@Parallels Staff Member

    Hello @BernhardB7,

    To try to eliminate any environment issues, please try the following:

    1. Manually launch the "prl-dev" (or whatever its name is) Boot2Docker virtual machine.
    2. Connect the respective device to that virtual machine via Parallels Desktop GUI and make sure it's available in that virtual machine.
    3. Check the device's exact location. E.g. dev/sdb1 (or in your case probably something like /dev/ttyUSB1 ).
    4. From inside the Boot2Docker virtual machine, execute:

    docker run -t -i --privileged -v <device_path>:<device_path> <docker_image> bash


    docker run -t -i --privileged -v /dev/sdb1:/dev/sdb1 ubuntu bash

    you should end up in bash of an Ubuntu container with your device mounted to the same location as it is mounted in the virtual machine.

    5. If this doesn't help, please collect a Parallels Desktop technical report (click Parallels icon > Help > Send technical data > check "Attach screenshots..." > press Send Report) and provide the report's 9-digit ID here. Also, please provide any additional details you deem relevant.

  3. BernhardB7

    BernhardB7 Bit poster

    The device, even when connected to `prl-dev`(Devices->USB & Bluetooth menu), is not listed in /dev on `prl-dev` (it does show up on the Mac when the connection is released from `prl-dev`.
    But lsusb, run in an ubuntu VM started from within `prl-dev` lists the device.
    I've submitted a Parallels Desktop technical report (416565079).
  4. Pavel Merkulov

    Pavel Merkulov Parallels Team

    Hello. Thank you for the provided data. To further investigate the issue you encountered, we have created a ticket and will contact you by email.

Share This Page