Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Since LXC (Linux Containers) is a kernel level super-chroot, I've been wondering what sort of video driver the containers have:

My host is Ubuntu 12.04 64-bit machine with ATI gpu. Will the LXC container have access to the same driver? Or do they need to be installed on each container?

share|improve this question
Please share a bit more on what you're trying to accomplish. Are you trying to run GUI applications or even OpenGL-enabled applications in your LXC container? – gertvdijk Dec 14 '12 at 12:57
up vote 3 down vote accepted

Please, take a look at this script to create a LXC container that runs steam with sound and video acceleration:

The magic comes here:

Outside LXC:

    # Add the bind mounts to the container's fstab
                                   "/tmp/.X11-unix tmp/.X11-unix "
                                   "none bind,ro")
                                   "/dev/dri dev/dri none bind,ro")
                                   "%s/pulse.socket home/%s/.pulse_socket "
                                   "none bind,ro" % (self.config_path,

We export X11 with a bind mount the /tmp/.X11-unix directory to allow container to use host X11. Do the same with /dev/dri directory and audio socket.

Inside LXC:

    # Get pulseaudio to listen on the socket
    with self.user_privileges():['pactl', 'load-module',
                        'socket=%s' % self.pulse_socket,

    # Start steam
        ["steam"], {'DISPLAY': os.environ['DISPLAY'],
                    'PULSE_SERVER': "/home/%s/.pulse_socket" %

Uses pactl to use a unix socket to communicate with host pulse audio server and later export the socket and DISPLAY environment variable to allow steam to use local X11 server and socket to audio server.

Take a look at the script and enjoy it :)

With that environment variables inside LXC you could play (theoretically) almost all games.

Best regards!

share|improve this answer
interesting. Have you tried to have at least 2 simultaneous containers using HW acceleration? – lurscher May 21 '15 at 17:03
No, I'm currently using Docker (not plain LXC) to run Gazebo 5 containers, I didn't try to run two containers running accelerated applications at once. I'll try it this afternoon and I'll tell you if it works (I think that it'll work). – OscarGarcia May 25 '15 at 8:00
Sorry for the delay. Yes, it is possible to run multiple LXC containers and run simultaneously several accelerated applications. Take a look to this video that I recorded for you: – OscarGarcia May 26 '15 at 16:04
Here is the github repository with the code used in the video: – OscarGarcia May 26 '15 at 16:21
so, and create the two containers and and start2.shstart each separately. What does do and in what order should it be run? – lurscher May 26 '15 at 17:23

Container-based 'virtualisation' technologies such as OpenVZ and LXC don't virtualize any hardware, unlike Xen, KVM, VMware, etc. Another major difference is that LXC/OpenVZ containers are running in the same instance of a single Linux kernel, whereas real virtual machines are running their own kernel.

Because the containers are inside the same kernel and don't manage any hardware, they're 'running' the same driver, yet they don't have any knowlegde about it. All processes are simply chroot'ed and this is completely independent of hardware drivers (kernel modules).

share|improve this answer
so, the question is: if i run LIBGL_DEBUG=verbose glxinfo | grep rendering inside the lxc container console, will i see "direct rendering: yes"? – lurscher Dec 14 '12 at 12:47
@lurscher I can't tell what you will see on your hardware. Usually, people are not running anything directly related to hardware in containers. Either way, I think this article might give you some insight. – gertvdijk Dec 14 '12 at 12:56
i mean, i can see direct rendering: yes on the host, but that doesn't translate directly to the container, because the system installation (including the fglrx driver) will not be shared with the containers, right? That article seems to point that at least some direct rendering is possible using the open source driver, which is a good fallback plan for me, but if i could rely on the propietary fglrx ati driver it would be golden – lurscher Dec 14 '12 at 13:06

To the best of my knowledge the lxc containers will have acess to the driver. check out this site for more info

share|improve this answer
Your link is a page about the Libvirt LXC client/plugin, they call a 'driver'. I don't see any information regarding video drivers or alike. – gertvdijk Dec 14 '12 at 8:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.