Docker容器可以调用主机Syscalls吗?
我正在MacOS 11.6上运行Docker容器(Alphine),该容器中有一个打字稿应用程序。我需要在主机上模拟和记录Docker的输入。是否可以以一种允许我的容器来设置docker,以使我的容器可以使用node.js osx-mouse
软件包控制主机的输入,或者通过编写swift包装器创建cgevent
s ?
I'm running a Docker container (alphine) on MacOS 11.6, there's a Typescript app in that container. I need to simulate and record input from Docker on host. Is it possible to setup Docker in a way that would allow my container to control host's input using node.js osx-mouse
package, or by writing a Swift wrapper creating CGEvent
s?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
几乎肯定是不可能的。总的来说,禁止Docker容器访问主机显示器或其他主机设备。由于Docker Desktop运行隐藏的Linux VM,因此特别困难:显示技术完全不同,VM层使其看起来像容器和主机在物理独立的系统上。
通常,如果您需要与主机显示或任何其他硬件进行交互,则在容器外运行任务要容易得多。
That's almost certainly not possible. In general Docker containers are prohibited from accessing the host display or other host devices. Since Docker Desktop runs a hidden Linux VM, it's especially difficult: the display technologies are totally different and the VM layer makes it look like the container and host are on physically separate systems.
As a general rule, if you need to interact with the host display or any other hardware, it's much easier to run the task outside a container.