从docker windowsservercore容器内访问虚拟COM端口 [英] Accessing virtual com ports from inside a docker windowsservercore container

查看:303
本文介绍了从docker windowsservercore容器内访问虚拟COM端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我正在尝试一种车队管理系统,我尝试在单独的泊坞窗图像中启动多个模拟车辆。

I'm trying out kind of a fleet management system where I try to fire up multiple simulated vehicles inside separate docker images.

这些车辆模拟器使用模拟gps将数据发送到虚拟COM端口,模拟车辆从中读取。

These vehicle simulators uses a simulated gps which send data to a virtual com port, from which the simulated vehicles read.

在Windows XP / 7 / Server 2016中我成功制作了使用com0com来创建虚拟COM端口。

In windows XP/7/Server 2016 I have successfully made use of com0com for creating the virtual com ports.

我的问题是在docker容器中安装虚拟com端口,或者访问它们作为主机上的设备

My problem is getting the virtual com ports installed inside a docker container, alternatively accessing them as devices on the host

我的第一次尝试是在docker中运行com0com,使用静默模式安装驱动程序工作正常,但在使用已安装的应用程序创建虚拟COM端口对时遇到问题。命令停止,如果我查看Application
事件日志,我每次尝试运行命令时都会看到几行。

My first attempt has been running com0com inside docker,  installation of the drivers work fine using silent mode, but when creating virtual com port pairs using the installed application I run into problems. The command stalls and if I view the Application eventlog I can see a few rows of this kind for each time I try to run the command.

< date> ; <时间>信息Windows错误代表... 1001故障桶,类型0  

而是尝试在主机,而不是传递设备,我似乎无法访问它们

When instead trying to create the devices in the host and instead passing the devices I seem to fail to access them

在容器中使用com0com --list我可以看到设备,但没有与我在主机中的名称相同

Using com0com --list within the container I can see the devices but not with the same name as I in the host

在关联的Dockerfile中,我使用com0com setupc.exe将它们重命名为与主机上标识的名称相同的名称

In the associated Dockerfile i rename them using the com0com setupc.exe to the same name as identified on the host

模式在主机上发出的命令正确地列出了端口,使用
模式  命令从insde看容器做的另一方面无法列出它们,只显示一个项目:CON

The mode command issued on the host lists the ports properly, using the mode command from insde the container does on the other hand fail to list them, only showing one item: CON

然后我尝试使用--device = // ./ COM128://./COM128参数传递给docker run

I then tried passing them using the --device=//./COM128://./COM128 argument to docker run

注意!:这是正确的"路径"吗?到设备?

NOTE!: Is this the correct "path" to the devices?

这个显着的结果是零, setupc 命令给出相同的结果,与
模式相同

The noticable result of this is zero, the setupc command gives the same result, same with mode

奇怪的是,当我运行PowerShell并列出串行端口时,我得到主机上可用的预期组件,正确的名称,但试图打开其中一个给出例外

The strange thing is that when I run powershell and list the serialports i get the expected comports as available on the host, with the correct names, but trying to open one of them gives an exception

最后尝试与上面几乎相同,但使用另一个虚拟COM端口软件,在主机中设置它们,尝试打开端口时的最终结果在容器中使用ps与com0com配置的端口相同

Finally tried just about the same as above but with another virtual com port software, setting them up in the host, the final result when trying to open the port using ps in the container is the same as for the com0com configured ports

欢迎所有关于如何前进的想法!

All ideas on how to move forward are welcome!

更新:

尝试了一种新方法,在hyper-v中运行容器相反,使用-isolation标志来停靠运行,假设您可以在hyper-v容器中安装com0com驱动程序,而不必尝试从主机共享它们。由于安装程序(基于NSIS)是一个32位应用程序,纳米服务器只能运行64位应用程序,因此目前
无法在nanoserver中运行com0com安装工具。

Tried a new approach, running the container in hyper-v instead, using the -isolation flag to docker run, given the thesis that you would be able to install the com0com drivers in a hyper-v container, not having to try to share them from the host. Currently stuck on not being able to run the com0com install tool in nanoserver since the installer(NSIS-based) is a 32bit application, nanoserver only able to run 64bit applications.

/ Kristofer

/Kristofer

推荐答案

您是否找到了解决此问题的方法?我在同一端尝试将COM端口转换为Windows docker容器。我真的很想知道这是否适合你。
Have you perhaps found a solution to this issue? I landed up at the same end trying to get a COM Port translation into a windows docker container. Would be really interested to hear if that worked out for you.


这篇关于从docker windowsservercore容器内访问虚拟COM端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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