support nvidia 32 and 64 bit drivers

pull/5/head
Andy 8 years ago
parent cf2ba993fd
commit 093751f98f
Signed by: arno
GPG Key ID: 368DDA2E9A471EAC

@ -39,24 +39,16 @@ RUN echo "deb [arch=amd64,i386] http://repo.steampowered.com/steam/ precise stea
# libcurl3 libcanberra-gtk-module
# Install NVIDIA Drivers.
# Currently supported versions: 304, 340, 361
# Currently supported versions: 304, 340, 361 (both 32 & 64 bit)
# TODO: use debian mirrors if possible?
# amd64 (when Steam will be 64-bit)
# ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-304/nvidia-304_304.131-0ubuntu4_amd64.deb /tmp/nvidia-304.deb
# ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-340/nvidia-340_340.96-0ubuntu4_amd64.deb /tmp/nvidia-340.deb
# ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-361/nvidia-361_361.42-0ubuntu2_amd64.deb /tmp/nvidia-361.deb
# i386 (Steam is 32-bit app currently :-/)
ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-304/nvidia-304_304.131-0ubuntu3_i386.deb /tmp/nvidia-304.deb
ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-340/nvidia-340_340.96-0ubuntu3_i386.deb /tmp/nvidia-340.deb
ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-361/nvidia-361_361.42-0ubuntu2_i386.deb /tmp/nvidia-361.deb
# amd64 (comes along with the i386)
ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-304/nvidia-304_304.131-0ubuntu4_amd64.deb /tmp/nvidia-304.deb
ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-340/nvidia-340_340.96-0ubuntu6_amd64.deb /tmp/nvidia-340.deb
ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-361/nvidia-361_361.42-0ubuntu2_amd64.deb /tmp/nvidia-361.deb
# Newer
# ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-304/nvidia-304_304.131-0ubuntu4_i386.deb /tmp/nvidia-304.deb
# ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-340/nvidia-340_340.96-0ubuntu6_i386.deb /tmp/nvidia-340.deb
# ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-361/nvidia-361_361.45.11-0ubuntu4_i386.deb /tmp/nvidia-361.deb
# ADD http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-361/nvidia-361_361.45.11-0ubuntu4_amd64.deb /tmp/nvidia-361.deb
RUN cd /tmp && \
ar xv nvidia-304.deb data.tar.xz && \
@ -112,5 +104,10 @@ WORKDIR $HOME
ENV STEAM_RUNTIME 0
COPY ./launch /launch
ENTRYPOINT [ "/launch" ]
#
# This part is very important, since this lets Steam choose proper nvidia drivers (32 or 64 bit)
#
# echo "$(find /usr/lib /usr/lib32 -maxdepth 1 -type d -name "*nvidia*" -print0 |tr '\0' ':' ; echo)"
ENV LD_LIBRARY_PATH "/usr/lib/nvidia-361:/usr/lib/nvidia-361-prime:/usr/lib/nvidia-340:/usr/lib/nvidia-340-prime:/usr/lib/nvidia-304:/usr/lib32/nvidia-361:/usr/lib32/nvidia-340:/usr/lib32/nvidia-304"
ENTRYPOINT [ "steam" ]

@ -14,32 +14,8 @@ Tested in Ubuntu 16.04 LTS (64bit) with the following GPU's:
## Limitations
- The version of your Nvidia drivers should match the ones in Dockerfile used to build this image
## Known issues
- Steam is working only with the 32-bit Nvidia drivers (which is in this image already)
- CS:GO (csgo_linux64) is working only with the 64-bit Nvidia drivers
To run CS:GO, you will need to download and extract the 64-bit Nvidia drivers while Steam is running:
```
docker exec -ti steam bash
root@steam-container:~# curl -o /tmp/nvidia-361.deb http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-361/nvidia-361_361.42-0ubuntu2_amd64.deb
root@steam-container:~# cd /tmp && ar xv nvidia-361.deb data.tar.xz && tar xf data.tar.xz -C / && rm -f data.tar.xz nvidia-361.deb
```
## Notes
- I have added the `/launch` script that will try to detect the working version of the NVIDIA drivers.
Currently this image supports these versions of the NVIDIA driver: 304, 340, 361.
It will fallback to the Generic OpenGL driver in case of failure.
- Do not forget to pass host device `/dev/nvidia-modeset` to a container when running with NVIDIA driver >= 361.
- The version of your Nvidia drivers should match the ones in Dockerfile used to build this image.
Currently this image supports these versions of the NVIDIA driver: 304, 340, 361.
# Building and launching Steam
@ -71,25 +47,6 @@ Also keep in mind to uncomment or/and add your devices to the `devices:` section
The best result is when you have a similar to the following output, using the `glxgears` (part of `mesa-utils` package):
```
$ docker-compose run --rm steam glxdebug
Attempting to load one of the supported NVIDIA drivers:
Trying to load NVIDIA driver version: 361 ... FAILURE
Trying to load NVIDIA driver version: 340 ... SUCCESS
LD_LIBRARY_PATH is set to: /usr/lib/nvidia-340
Running synchronized to the vertical refresh. The framerate should be
approximately the same as the monitor refresh rate.
GL_RENDERER = GeForce GTX 560 Ti/PCIe/SSE2
GL_VERSION = 4.4.0 NVIDIA 340.96
GL_VENDOR = NVIDIA Corporation
GL_EXTENSIONS = GL_AMD_multi_draw_indirect GL_ARB_arrays_of_arrays ...
...
305 frames in 5.0 seconds = 60.878 FPS
301 frames in 5.0 seconds = 60.011 FPS
301 frames in 5.0 seconds = 60.009 FPS
305 frames in 5.0 seconds = 60.807 FPS
```
If you are getting `segmentation fault` error or Steam does not start, then you could try resetting its config:
```

@ -1,76 +0,0 @@
#!/bin/bash
# This script will attempt to load one of the NVIDIA driver version which
# present in this script, otherwise it will try to fallback to the Generic
# OpenGL driver (libgl1-mesa-glx)
# The list of Nvidia Supported Driver Version which present in this container
NSDV="361 340 304"
# Try to load the Generic OpenGL driver (libgl1-mesa-glx)
# Return 0 on success
function testGeneric {
export LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/mesa
glxinfo >/dev/null 2>&1
return $?
}
# Try to load the NVIDIA driver
# Return 0 on success
function testNvidiaVer {
export LD_LIBRARY_PATH=/usr/lib/nvidia-$1
[ -e "$LD_LIBRARY_PATH/libGL.so.1" ] && glxinfo >/dev/null 2>&1
return $?
}
#
# Go through all available in this container versions of the NVIDIA drivers and
# return the version which worked.
# If none of the NVIDIA drivers worked, then try to load the Generic OpenGL
# driver.
#
# Return 0 on success
# Return 1 if none of the graphic drivers worked, including the Generic OpenGL
#
function detectNvidiaDriver {
echo "Attempting to load one of the supported NVIDIA drivers: "
for ver in $NSDV; do
echo -n " Trying to load NVIDIA driver version: $ver ... "
testNvidiaVer $ver
RC=$?
if [ $RC -eq 0 ]; then
echo "SUCCESS"
return $ver
else
echo "FAILURE"
fi
done
echo "Attempting to load the Generic OpenGL driver ..."
testGeneric
RC=$?
return $RC
}
#
# START
#
detectNvidiaDriver
RC=$?
if [ $RC -eq 0 ]; then
echo "NVIDIA drivers could not be loaded."
echo "Generic OpenGL driver will be used"
elif [ $RC -eq 1 ]; then
echo "None of the supported NVIDIA drivers worked :/"
echo "Please try installing one of the supported NVIDIA drivers"
echo "Supported NVIDIA driver version are: $NSDV"
fi
export LD_LIBRARY_PATH
echo "LD_LIBRARY_PATH is set to: $LD_LIBRARY_PATH"
# This script understands the "glxdebug" argument
if [ "$1" == "glxdebug" ]; then
glxgears -info
else
steam $@
fi
Loading…
Cancel
Save