diff --git a/Dockerfile b/Dockerfile index 5e6ca9c..fd61917 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,44 +1,37 @@ -FROM andrey01/xenial32 +FROM debian:jessie MAINTAINER Andrey Arapov # To avoid problems with Dialog and curses wizards ENV DEBIAN_FRONTEND noninteractive -# -# Prepare the image -# -# ---------------------------------------------------------------------------- -# TODO: move the following workarounds directly into the xenial32 image ! -RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main restricted" > /etc/apt/sources.list && \ - echo "deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted" >> /etc/apt/sources.list && \ - echo "deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted" >> /etc/apt/sources.list && \ - echo "deb http://archive.ubuntu.com/ubuntu/ xenial universe" >> /etc/apt/sources.list && \ - echo "deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe" >> /etc/apt/sources.list && \ - echo "deb http://archive.ubuntu.com/ubuntu/ xenial-security universe" >> /etc/apt/sources.list - -# Workaround to xenial32's following error: -# initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused -RUN dpkg-divert --local --rename --add /sbin/initctl && \ - ln -s /bin/true /sbin/initctl - -# Prevent the services from automatically being started after they have been installed -RUN echo -e '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d && \ - chmod +x /usr/sbin/policy-rc.d -# ---------------------------------------------------------------------------- - - # 1. Keep the image updated # 2. Install the dependencies # 3. Install the latest version of Steam # http://repo.steampowered.com/steam RUN echo "deb [arch=amd64,i386] http://repo.steampowered.com/steam/ precise steam" > /etc/apt/sources.list.d/tmp-steam.list && \ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0xF24AEA9FB05498B7 && \ + dpkg --add-architecture i386 && \ apt-get update && \ apt-get -y upgrade && \ apt-get -y dist-upgrade && \ apt-get -fy install && \ - apt-get -y install binutils pciutils pulseaudio mesa-utils libcanberra-gtk-module \ - libopenal1 libnss3 libgconf-2-4 libxss1 libnm-glib4 libnm-util2 libglu1-mesa steam && \ + apt-get -y install binutils pciutils pulseaudio libcanberra-gtk-module \ + libopenal1 libnss3 libgconf-2-4 libxss1 libnm-glib4 \ + libnm-util2 libglu1-mesa locales \ + steam-launcher \ + mesa-utils:i386 \ + libstdc++5 libstdc++5:i386 libbz2-1.0:i386 \ + libavformat56 libswscale3 libavcodec56:i386 \ + libavformat56:i386 libavresample2:i386 libavutil54:i386 \ + libswscale3:i386 libsdl2-2.0-0 libsdl2-2.0-0:i386 \ + libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libc6:i386 \ + libxtst6:i386 libxrandr2:i386 libglib2.0-0:i386 \ + libgtk2.0-0:i386 libgdk-pixbuf2.0-0:i386 libsm6:i386 \ + libice6:i386 libopenal1:i386 libdbus-glib-1-2:i386 \ + libnm-glib4:i386 libnm-util2:i386 libusb-1.0-0:i386 \ + libnss3:i386 libgconf-2-4:i386 libxss1:i386 libcurl3:i386 \ + libv8-dev:i386 \ + libcanberra-gtk-module:i386 libpulse0:i386 && \ rm -f /etc/apt/sources.list.d/tmp-steam.list && \ rm -rf /var/lib/apt/lists @@ -47,10 +40,24 @@ RUN echo "deb [arch=amd64,i386] http://repo.steampowered.com/steam/ precise stea # Install NVIDIA Drivers. # Currently supported versions: 304, 340, 361 +# 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 +# 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 + + RUN cd /tmp && \ ar xv nvidia-304.deb data.tar.xz && \ tar xf data.tar.xz -C / && \ @@ -66,11 +73,6 @@ RUN cd /tmp && \ tar xf data.tar.xz -C / && \ rm -f data.tar.xz nvidia-361.deb - -# Set the locale to en_US.UTF-8 -RUN locale-gen en_US.UTF-8 && \ - update-locale - # Workaround missing lib in .local/share/Steam/ubuntu12_32/steamclient.so RUN ln -sv libudev.so.1 /lib/i386-linux-gnu/libudev.so.0 @@ -80,10 +82,23 @@ RUN echo "enable-shm = no" >> /etc/pulse/client.conf # Workaround: Ubuntu 16.04 doesn't have libgcrypt11, so we take it from trusty # Required by Half-Life based games -ADD http://archive.ubuntu.com/ubuntu/pool/main/libg/libgcrypt11/libgcrypt11_1.5.3-2ubuntu4_i386.deb /tmp/libgcrypt11.deb +# TODO: use debian mirrors if possible? +ADD http://archive.ubuntu.com/ubuntu/pool/main/libg/libgcrypt11/libgcrypt11_1.5.3-2ubuntu4_i386.deb /tmp/libgcrypt11_i386.deb +ADD http://archive.ubuntu.com/ubuntu/pool/main/libg/libgcrypt11/libgcrypt11_1.5.3-2ubuntu4_amd64.deb /tmp/libgcrypt11_amd64.deb RUN cd /tmp && \ - dpkg -i libgcrypt11.deb && \ - rm -f libgcrypt11.deb + dpkg -i libgcrypt11_*.deb && \ + rm -f libgcrypt11_*.deb + + +# locale-gen: Generate locales based on /etc/locale.gen file +# update-locale: Generate config /etc/default/locale (later read by /etc/pam.d/su, /etc/pam.d/login, /etc/pam.d/polkit-1) +RUN sed -i.orig '/^# en_US.UTF-8.*/s/^#.//g' /etc/locale.gen && \ + locale-gen && \ + update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 + +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + # Create a user ENV USER user diff --git a/README.md b/README.md index bc91cad..efd7579 100644 --- a/README.md +++ b/README.md @@ -14,27 +14,35 @@ Tested in Ubuntu 16.04 LTS (64bit) with the following GPU's: ## Limitations -- 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. +- The version of your Nvidia drivers should match the ones in Dockerfile used to build this image -- Do not forget to pass host device `/dev/nvidia-modeset` to a container when running with NVIDIA driver >= 361. +## Known issues -# Building and launching Steam +- Steam is working only with the 32-bit Nvidia drivers -## Create 32bit image +- CS:GO (csgo_linux64) is working only with the 64-bit Nvidia drivers -Create 32-bit Ubuntu 16.04 LTS (xenial) image +To run CS:GO, you will need to download and extract the 64-bit Nvidia drivers while Steam is running: ``` -sudo apt-get -y install debootstrap -sudo debootstrap --arch=i386 xenial /tmp/xenial-chroot http://archive.ubuntu.com/ubuntu -sudo tar -C /tmp/xenial-chroot -c . | docker import - xenial32 -sudo rm -rf /tmp/xenial-chroot -docker tag xenial32 andrey01/xenial32:latest +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. + + +# Building and launching Steam + ## Build Steam Docker image You may want to re-run this command later on in order to keep the image updated. @@ -49,8 +57,8 @@ docker build -t andrey01/steam . You can use the following shortcut function and place it to your `~/.bash_aliases` file ``` -function docker_helper() { (cd ~/docker/$1; docker-compose run --rm "$@" & disown) } -function steam() { (docker_helper $FUNCNAME $@) } +function docker_helper() { { pushd ~/docker/$1; docker-compose rm -fa "$1"; docker-compose run -d --name "$1" "$@"; popd; } } +function steam() { { docker_helper $FUNCNAME $@; } } ``` Then just issue "steam" command to run Steam in docker. diff --git a/launch b/launch index 4403add..efa5bd1 100755 --- a/launch +++ b/launch @@ -70,7 +70,7 @@ echo "LD_LIBRARY_PATH is set to: $LD_LIBRARY_PATH" # This script understands the "glxdebug" argument if [ "$1" == "glxdebug" ]; then - linux32 glxgears -info + glxgears -info else - linux32 steam $@ + steam $@ fi