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

2

6

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?

Parallelize answered 28/11, 2014 at 18:43 Comment(1)
Sounds like it tries to grab the GPU hardware and is allowed to. This will not end well.Sentimentalize
C
3

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://mcmap.net/q/46942/-alternatives-to-ssh-x11-forwarding-for-docker-containers

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.

Calmative answered 28/11, 2014 at 20:20 Comment(2)
It is not convenient to use host X server, because it may not exist. Ideally, I'd want a solution that works on both desktop and server machines. I need X server because I need "display" in OpenGL context initialization: Display* display = XOpenDisplay( displayName );Parallelize
Sorry, I have no idea.Calmative
R
0

If you don't mind using CPU for OpenGL, you can set up an X server inside the container with the Xdummy video driver with GLX extensions. But of course you won't be able to see a thing because the video driver is, well, dummy.

If you do want to play with GUIs, try TurboVNC + VirtualGL and use the Xdummy server as the 3D X server.

Reef answered 13/9, 2017 at 16:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.