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?

Aleksei Petrenko
  • 6,698
  • 10
  • 53
  • 87

2 Answers2

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://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.

Community
  • 1
  • 1
Adrian Mouat
  • 44,585
  • 16
  • 110
  • 102
  • 1
    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 ); – Aleksei Petrenko Nov 28 '14 at 20:37
  • Sorry, I have no idea. – Adrian Mouat Nov 29 '14 at 01:59
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.

zaxliu
  • 2,726
  • 1
  • 22
  • 26