Funtoo's official Steam container for use with NVIDIA graphics is based on Ubuntu 18, since Steam and Ubuntu have an unholy alliance and this is the officially-supported platform for Steam. That's fine -- we can still run Steam on Ubuntu -- on Funtoo!
The base Ubuntu container image upon which our container is an official Ubuntu container from NVIDIA Corporation and has been configured to work perfectly with container GPU acceleration and libglvnd.
Steam in Docker: Requirements
This page will currently document the setup of Steam running on NVIDIA hardware, with documentation for non-NVIDIA hardware to follow shortly.
To run Steam on NVIDIA GPUs, you must meet the following prerequisites:
- You must be using Funtoo Linux 1.4 or later, x86-64bit.
- You must have an NVIDIA graphics card.
- Already have NVIDIA drivers (
x11-drivers/nvidia-drivers) installed and a desktop environment running that uses them.
- A regular, non-root user created from which you will be launching Steam.
- PulseAudio working.
If you are using the Funtoo Linux GNOME stage3 as a starting point, you should be in good shape regarding all these requirements.
To get your host ready to run Steam, emerge the following package:
root # emerge -av --jobs=3 steam-nvidia-launcher
You will also want to ensure that you have NVIDIA proprietary graphics running in a graphical environment on your host. Please ensure that you have
x11-drivers/nvidia-kernel-modules-435.21-r1 or later installed on your host, and that you don't have any special permissions settings in
/etc/modprobe.d (See the Device Node Permissions section below for details.)
Next, you will want to add
nvidia-container to your default runlevel, and start them:
root # rc-update add docker default * service docker added to runlevel default root # rc-update add nvidia-container default * nvidia-container added to runlevel default. root # rc
Check Device Node Permissions
If you are using
x11-drivers/nvidia-kernel-modules-435.21-r1 or later, and have run
etc-update, then your device nodes should have correct permissions for GPU acceleration to work:
user $ ls /dev/nvidia* -l crw-rw-rw- 1 root root 195, 254 Oct 23 10:09 /dev/nvidia-modeset crw-rw-rw- 1 root root 239, 0 Oct 23 10:09 /dev/nvidia-uvm crw-rw-rw- 1 root root 239, 1 Oct 23 10:09 /dev/nvidia-uvm-tools crw-rw-rw- 1 root root 195, 0 Oct 23 10:08 /dev/nvidia0 crw-rw-rw- 1 root root 195, 255 Oct 23 10:08 /dev/nvidiactl
Otherwise, you will need to follow these steps. To allow all local users to access your GPU, not just the
video user, by setting
/etc/modprobe.d/nvidia.conf and rebooting.
With the host and device node permissions set up properly, you should be able to run
nvidia-container-cli info as your regular user and see details about your GPU and not receive any error messages:
user $ nvidia-container-cli info NVRM version: 435.21 CUDA version: 10.1 Device Index: 0 Device Minor: 0 Model: Quadro P400 Brand: Quadro GPU UUID: GPU-9bb98f5f-7d9d-ee0a-64a1-154c46934f45 Bus Location: 00000000:01:00.0 Architecture: 6.1
If you receive an error message, this indicates that your
/dev/nvidia* device node permissions are too restrictive or that
/etc/init.d/nvidia-container has not been started properly. Try rebooting or restarting Docker to resolve the issue.
When using docker, you will be starting the Steam container as a regular user account so the container can inherit the connection to
your X server. You will want to make sure your user account is in the
root # gpasswd -a drobbins docker Adding user drobbins to group docker
You will need to log out and log back in for this group change to take effect.
In order to allow the container to connect to PulseAudio, you will of course need to be using PulseAudio, and then you will also need to enable support for UNIX socket connectivity in PulseAudio. This can be done by modifying the
module-native-protocol-unix line in
/etc/pulse/default.pa to have the
load-module module-native-protocol-unix auth-anonymous=1
You should restart your user's pulseaudio daemon for this to take immediate effect:
user $ killall pulseaudio
Once this has been done, you should be able to see a
native UNIX socket in the PulseAudio run directory. This socket will get mapped into the container:
user $ ls $XDG_RUNTIME_DIR/pulse/ native pid
Docker Container Setup
To start the Steam container, run
steam-nvidia-launcher as a regular user:
user $ steam-nvidia-launcher
steam-nvidia-launcher takes care of the full Steam container lifecycle. You simply run it as your local user, and it will download the official Funtoo Steam docker image and launch it. The launcher will stay running until you hit Control-C, at which point it will stop Steam and also stop the container.
The next time you want to start Steam, you'll run the launcher, and it will find the existing container, start it, and start Steam. Just like before, when you want to stop Steam and the container, hit Control-C and Steam and the container will be stopped.
Since it is the initial run of the launcher, it will download the Docker image first, which is about 1.5GB in size, and then it will launch a new container image. You should see Steam start to update itself, and then when this is done it will prompt you to log in to Steam. Congratulations! Steam is now running!
It is possible to open a bash shell within an already launched container by running the following command in another X terminal:
user $ steam-nvidia-launcher attach steam-container #
From this point, you can inspect the state of the running container interactively and test out various parts of its operation.
When you are done, you can exit the container by pressing Control-D or typing
To ensure that PulseAudio is functioning properly from within the container, the following command can be run to play back white noise via PulseAudio:
steam-container # pacat -vvvv /dev/urandom
To ensure that OpenGL is working properly from within the container, and that the container is properly connecting to your X server, you can run
steam-container # glxgears
You should see glxgears running in a window on your desktop.
The work on Steam on Funtoo is ongoing with the following efforts planned:
- Support for Steam on Open Source drivers, not just NVIDIA.
- Storage of Steam Library and configuration outside of the container, so that wiping the container image will not wipe your downloaded games. (DONE: Supported in version 1.4)
- Support for integration of Desktop shortcuts with your native DE.