Serial port unavailable under Windows even with --privileged flag
Description
I got a device that talk over serial port. On Unix it shows up as a /dev/ttyUSB0, on Windows as a COM. I would like to be able to talk to this serial device from a container running on top of Docker for Windows.
Steps to reproduce the issue:
- Connect something that talk over a USB serial port to your Windows machine
- docker run -it --privileged ubuntu ls /dev
Describe the results you received:
- There is no ttyUSB0
Describe the results you expected:
There should be a ttyUSB0 showing up
Additional information you deem important (e.g. issue happens only occasionally):
Output of docker version:
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:30:30 2017
OS/Arch: windows/amd64
Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:51:55 2017
OS/Arch: linux/amd64
Experimental: true
Output of docker info:
Containers: 6
Running: 0
Paused: 0
Stopped: 6
Images: 3
Server Version: 17.06.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.36-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 973.8MiB
Name: moby
ID: TMWG:M7LS:5PG2:EZ4E:37KI:UGHT:OJIR:AVKU:V42E:GVNL:2GR4:QNJW
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 15
Goroutines: 25
System Time: 2017-08-18T09:09:52.1702444Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Thanks for opening this issue for tracking this feature request. We've had a few similar requests for USB device support. Currently this is not a design use-case for Docker for Windows.
You might be able to achieve what you want by setting up a separate hyper-v (or virtualbox) VM and installing Docker in that. That would give you more freedom to use hyper-v features like attaching special host-hardware and using it with Docker Linux containers.
You can even use Docker Machine to automate part of this process: https://docs.docker.com/machine/drivers/hyper-v/
Does this issue still persist? I'm also looking for a way to connect serial devices to containers in Docker for Windows. @sieben did you find any working option for your use-case?
Nope it doesn't seems to be an issue that is going to be solved soon. I've simply dropped using docker in this context and moved to something else.
Le 17 nov. 2017 23:55, "Vitalii Plagov" [email protected] a écrit :
Does this issue still persist? I'm also looking for a way to connect serial devices to containers in Docker for Windows. @sieben https://github.com/sieben did you find any working option for your use-case?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/docker/for-win/issues/1018#issuecomment-345387985, or mute the thread https://github.com/notifications/unsubscribe-auth/AASXIq-dYQ_ySN0g9H9RBUfAy8EjVOtkks5s3g7tgaJpZM4O796v .
I would also love to have serial ports implemented in Docker For Windows.
There is high demand from people that want to use Docker for cross platform embedded toolchain environments. Maybe the Docker team should reconsider...
I would definitely love to see this implemented. It will be a much more common request since Azure IoT Edge leverages docker containers for modules -> http://docs.microsoft.com/en-us/azure/iot-edge
Does this issue still persist? this issue is highly demanded by a lot of people
Hyper-V does not seem to allow passing through local USB devices to a VM so we can't expose serial USB device or similar to the VM running linux containers
Any update on this issue? is it supported now? i was exploring for similar results on windows host.
This feature is highly desired to use with Azure IoT Edge. Is this going to be implemented soon?
I'd be very interested in this feature as well. (Need to talk to COM-ports from Docker containers..)
Hi folks,
My team is interested in learning more about the needs discussed in this thread and to better understand what outcomes you are trying to enable. We'd be interested in hearing your responses to the following questions:
- What scenarios are you targeting?
- Are the scenarios primarily for IoT enterprise solutions?
- What type of devices are you interfacing with that require serial or USB access (specific examples would be great)?
- Is there any workaround or interim solution that might solve your needs in the absence of access from containers?
- Are you looking to use Win32 APIs (CreateFile, ReadFile, WriteFile, DeviceIoControl, etc.) or some other APIs to access these devices?
- Can you identify which APIs would be required to meet your needs?
Thanks in advance for any details you can provide to help us better understand how your needs could be met.
@lenz45
- I'm trying to run ESP-IDF on my Windows maching without using MINGW32.
- My use is primary for the IoT
- ESP32 Devboard-C
- Current workaround is using MinGW
- No I don't need to use Win32 API
@lenz45
- Attempting to use an encoder that talks over serial to a Node application. Won't be able to use Docker without this feature. We use physical computing with node.js a lot, so having support for serial with Docker would be really helpful.
- Not primarily IoT
- Rotary Encoder from RLS
- Having trouble finding a workaround
- No
- Don't necessarily need an API
@lenz45
- We want to standardize our embedded flashing toolchain. All we need to be able to do is map Windows COM ports to /dev/ttyUSBxx devices inside the Docker container. Our Dockerfile works on Linux.
- It's not IoT but it is embedded programming.
- ST-LINK/V2 and FTDI FT232RL chips.
- We currently use the Windows Subsystem for Linux which can map serial ports.
An inconvenience is that /dev/ttyS1 through 100 are predefined and you need to run
mode.comon Windows to find what COM ports are defined (say COM7) and then connect to /dev/ttyS7 on the WSL side. - No. We just need a mapping for serial ports.
What scenarios are you targeting?
Azure IOT Edge scenarios that talk to hardware...
Are the scenarios primarily for IoT enterprise solutions?
yes
What type of devices are you interfacing with that require serial or USB access (specific examples would be great)?
industrial machines that talk over RS232; Modbus over serial; GPIO/I2C/SPI-based sensors
Is there any workaround or interim solution that might solve your needs in the absence of access from containers?
Nope
Are you looking to use Win32 APIs (CreateFile, ReadFile, WriteFile, DeviceIoControl, etc.) or some other APIs to access these devices?
System.IO.Ports for C#; pyserial for python; serialport for node, etc...
Can you identify which APIs would be required to meet your needs?
Thanks for the responses you provided and apologies for not getting back to this thread sooner. I was waiting for a blog post to go live that explains some work Microsoft is doing in this area. Please take a look at the post here and feel free to provide feedback directly on the TechNet site: https://blogs.technet.microsoft.com/virtualization/2018/08/13/bringing-device-support-to-windows-server-containers/
@lenz45 But this works only for windows container on windows host.
Is it possible to use a com device insinde a linux container on a windows host??
@s4ndst0rm You are correct that this work pertains strictly to Windows containers on Windows. As of today, you cannot access a COM device (or any other host device) from a Linux container running on Windows. However, all feedback we can gather around this scenario would be helpful in guiding us.
All we need to be able to do is map Windows COM ports to /dev/ttyUSBxx devices inside the Docker container. Our Dockerfile works on Linux. It's IoT embedded programming. ST-LINK/V2 While not decide No. We just need a mapping for serial ports.
We also need access to an RS232 interface from Linux Docker running on a Windows host. This means map a Windows COM port to a /devttySx device.
@lenz45 I'm trying to flash esp-idf from a Linux docker runs under windows 10. I don't want to use Mingw32.
@lenz45
Embedded device build, flash and test yes Embedded boards that talk over Serial Port Nope Nope
For the sake of a "me too":
-
What scenarios are you targeting? Embedded development on ESP32-based devices (WiFi modules)
-
Are the scenarios primarily for IoT enterprise solutions? Yes
-
What type of devices are you interfacing with that require serial or USB access (specific examples would be great)? uBlox Nina EVK board (ESP32-based WiFi module), using an FTDI-based USB-serial converter
-
Is there any workaround or interim solution that might solve your needs in the absence of access from containers? Possibly a means of getting the ESP32 code to actually compile under Windows.
-
Are you looking to use Win32 APIs (CreateFile, ReadFile, WriteFile, DeviceIoControl, etc.) or some other APIs to access these devices? No
-
Can you identify which APIs would be required to meet your needs? No. All we want is to talk to the USB COM port.
- What scenarios are you targeting? We have serial medical devices for which we develop integration solutions. This feature would benefit us for our docker based dev environment.
- Are the scenarios primarily for IoT enterprise solutions? IoT is also in scope.
- What type of devices are you interfacing with that require serial or USB access (specific examples would be great)? https://datainnovations.com/jresultnet is a middleware we currently use for interfacing with the medical devices. few such medical devices are https://www.beckmancoulter.com/en/products/hematology/dxh-800, http://www.immucor.com/global/Products/Pages/Neo.aspx, https://www.transfusion.abbott/int/en/offerings/brands/prism/prism-next
- Is there any workaround or interim solution that might solve your needs in the absence of access from containers? Virtualbox
- Are you looking to use Win32 APIs (CreateFile, ReadFile, WriteFile, DeviceIoControl, etc.) or some other APIs to access these devices? No
- Can you identify which APIs would be required to meet your needs? We be using Java API libraries such as jSerialComm.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30d of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale
I'm also experiencing this issue, trying to communicate with a NewportESP 301 controller in windows from a docker container. Cannot see the port with neither 'COMX' or '/dev/ttyUSBx' notation.
Does this issue still persist? I'm also looking for a way to connect USB devices to containers(Linux) in Docker for Windows.
I think it still persists. This article from 16-May-19 states that Hyper-V-isolated Linux Container does not support device assignment and sharing.
Is it possible to disable Hyper-V, install VirtualBox and use docker-machine with VirtualBox on Windows to allow access to USB devices to Linux containers?