Windows 10 Docker 主机 - 从 Linux 容器显示 GUI 应用程序 [英] Windows 10 Docker Host - Display GUI application from Linux Container

查看:29
本文介绍了Windows 10 Docker 主机 - 从 Linux 容器显示 GUI 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Windows 10 作为我的主机并运行包含基于 gui 的应用程序的 Docker 容器,并使用 X11 转发或类似的方式显示它们.我在网上找到的几乎所有信息都与 Linux Host to Linux Container 相关(例如 - http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker) 暴露了 socket/x11 权限的地方.我发现的其他信息来自以前的 Boot2Docker/Windows 实现,其中需要 virtualbox 作为设置过程的一部分并且需要 VNC.

I'm trying to use Windows 10 as my host and run Docker containers that contain gui based applications and display them using X11 forwarding or something similar. Pretty much all of the information I've found online deal with Linux Host to Linux Container (example - http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker) where the socket / x11 authority are exposed. Other information I've found is from previous implementations of Boot2Docker / Windows where virtualbox was required as part of the setup procedure and required VNC.

目前的基本设置,有谁知道必须调整什么才能让 Firefox 在主机系统的窗口中显示?--

Basic setup currently, does anyone know what has to be adjusted to get Firefox to display within a window on the host system? --

在 Windows 10 主机上启动 XMing 服务器

Start an XMing server on Windows 10 host

FROM ubuntu:14.04
RUN apt-get update && apt-get install -y firefox
CMD /usr/bin/firefox

命令

PS> docker build -t firefox .
PS> set-variable -name DISPLAY -value localhost:0.0
PS> docker run -ti --rm -e DISPLAY=$DISPLAY firefox

谢谢

推荐答案

您需要将 DISPLAY 设置为 localhost 以外的值.容器有自己的 localhost 接口,因此您的 X11 客户端将尝试连接到它自己而不是您的主机.

You'll need to set DISPLAY to something other than localhost. The container has its own localhost interface, so your X11 client will attempt to connect to itself instead of to your host.

相反,您可以传入 Windows 机器的网络适配器的 IP 地址.容器将能够连接到它.您还需要将 X11 服务器配置为侦听该接口.

Instead, you can pass in an IP address of your windows machine's network adapter. The container will be able to connect to that. You'll also need to have your X11 server configured to listen on that interface.

这篇关于Windows 10 Docker 主机 - 从 Linux 容器显示 GUI 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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