Docker容器看不到串行端口设备 [英] Docker container can't see a serial port device

查看:727
本文介绍了Docker容器看不到串行端口设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行可访问主机上串行端口的Docker容器.

I'm trying to run a Docker container with access to a serial port on the host.

这是我所做的:

  • 我用过Mac
  • 主机上已安装的驱动程序 ( http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=229&pcid=41 )
  • 插入设备
  • 返回的
  • ls /dev/t* /dev/tty.usbserial-如此奏效
  • 先运行容器docker run -it --privileged -v /dev:/dev node:4.4.0 /bin/bash,然后在未返回/dev/tty.usbserial设备的容器内运行ls /dev/t* ...
  • I used a Mac
  • Installed drivers on the host (http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=229&pcid=41)
  • Plugged in the device
  • Ran ls /dev/t* that returned /dev/tty.usbserial - so it worked
  • Ran the container, docker run -it --privileged -v /dev:/dev node:4.4.0 /bin/bash, and then ls /dev/t* inside the container which didn't return the /dev/tty.usbserial device...

我玩了很多不同的参数,但是我没有找到有效的参数:)

I played a lot with different variations of parameters, but I haven't found the working one :)

--device标志也不适合我,因为可能会重新连接设备,并且名称可能与/dev/tty.usbserial不同.

Also the --device flag is not suitable for me since the device might be reconnected and the name could differ from /dev/tty.usbserial.

推荐答案

由于该守护程序在Docker Desktop中的VM内运行,因此实际上无法与VM内的容器共享Mac主机设备,这绝对是不可能的.

As the daemon runs inside a VM in Docker Desktop, it is not possible to actually share a mac host device with the container inside the VM, and this will most definitely never be possible.

这篇关于Docker容器看不到串行端口设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆