当我在Docker容器中启动X服务器时,主机屏幕关闭 [英] Host screen turns off when I start X server in docker container

查看:542
本文介绍了当我在Docker容器中启动X服务器时,主机屏幕关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在其中创建了带有X服务器的docker容器。我用它来进行一些离线的OpenGL渲染。
这个容器应该在任何系统上运行(有或没有X服务器运行),它应该使用硬件GPU(如果它存在)(所以我不能使用xvfb)。



当我在没有GUI的服务器式系统上使用这个容器时,一切都很完美。但是当我在Ubuntu 14.04桌面上运行容器时,每次在我的容器中启动X服务器时,屏幕都会关闭。



我使用--priviliged so / dev启动容器文件夹与容器共享。我相信它涉及某种冲突。



有没有办法在容器内启动X,如主机X服务器仍然工作?



更新:



我在Xorg.0.log中看到以下内容:

  AIGLX:暂停用于VT切换的AIGLX客户端
(II)NOUVEAU(0):调用NVLeaveVT。

更新:



我可以使用xvfb而不是真正的Xorg服务器吗?它是否支持实际的硬件GPU渲染?

解决方案

我不认为这将会起作用 - 你有效地尝试使用两台X服务器(主机和容器),我怀疑他们都期待独家使用视频卡。



您可以做的是使用X服务器上的主机从容器通过绑定安装X Server套接字。此SO答案解释了如何: https://stackoverflow.com/a/25334301/4332



我不知道这将有助于您的具体情况,但我不完全明白为什么您需要在容器中运行的XServer。我认为你仍然可以使用--privileged访问GPU。


I created docker container with X server inside. I use it for some off-screen OpenGL rendering. This container should work on any system (with or without X server running) and it should use hardware GPU if it exists (so I cannot use xvfb).

When I use this container on server-like system without GUI, everything works perfectly. But when I run the container on Ubuntu 14.04 Desktop, the screen turns off each time I start X server in my container.

I start container with --priviliged so /dev folder is shared with container. I believe it involves some kind of conflict.

Is there a way to start X inside the container such as host X server is still working?

UPDATE:

I see the following in Xorg.0.log:

AIGLX: Suspending AIGLX clients for VT switch
(II) NOUVEAU(0): NVLeaveVT is called.

UPDATE:

Can I use xvfb instead of real Xorg server? Does it support actual hardware GPU rendering?

解决方案

I don't think this is going to work - you're effectively trying to use two X servers - the host and the container - and I suspect they are both expecting to have exclusive use of the video card.

What you can do instead is use the X server on the host from the container by bind-mounting the X Server socket. This SO answer explains how: https://stackoverflow.com/a/25334301/4332

I'm not sure this will help in your particular case, but I don't entirely understand why you need an XServer running in the container at all. I think you should still have access to the GPU with --privileged.

这篇关于当我在Docker容器中启动X服务器时,主机屏幕关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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