Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Host screen turns off when I start X server in docker container

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?

like image 809
Aleksei Petrenko Avatar asked Nov 28 '14 18:11

Aleksei Petrenko


1 Answers

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.

like image 135
Adrian Mouat Avatar answered Oct 24 '22 08:10

Adrian Mouat