first commit

pull/5/head
Andy 8 years ago
parent c323d36628
commit 656edbc183
Signed by: arno
GPG Key ID: 368DDA2E9A471EAC

@ -0,0 +1,73 @@
FROM andrey01/xenial32
MAINTAINER Andrey Arapov <andrey.arapov@nixaid.com>
# 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 && \
apt-get update && \
apt-get -y upgrade && \
apt-get -y dist-upgrade && \
apt-get -fy install && \
apt-get -y install pciutils pulseaudio nvidia-current mesa-utils steam && \
rm -f /etc/apt/sources.list.d/tmp-steam.list && \
rm -rf /var/lib/apt/lists
# 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 /lib/i386-linux-gnu/libudev.so.1 /lib/i386-linux-gnu/libudev.so.0
# Workaround: pulseaudio client library eager to remove /dev/shm/pulse-shm-* files created by the host,
# causing sound to stop working
RUN echo "enable-shm = no" >> /etc/pulse/client.conf
# Create a user
ENV USER user
ENV UID 1000
ENV GROUPS audio,video
ENV HOME /home/$USER
RUN useradd -m -d $HOME -u $UID -G $GROUPS $USER
# Tools which might be helpful in troubleshooting
# RUN apt-get -y install alsa-utils mesa-utils vim less gdb strace binutils
USER $USER
WORKDIR $HOME
# ENV STEAM_RUNTIME 0
# steam --reset
# ENTRYPOINT [ "linux32", "steam" ]
# ENTRYPOINT [ "steam" ]
COPY ./launch /launch
ENTRYPOINT [ "/launch" ]

@ -0,0 +1,87 @@
# Steam in Docker
Tested in Ubuntu 16.04 LTS (64bit) with the following GPU's:
- Intel HD Graphics 3000
- Intel HD Graphics 4400
- NVIDIA's GeForce GTX 560 Ti
## Requirements
- [Docker](https://www.docker.com/)
- (Optional) [Docker Compose](https://docs.docker.com/compose/)
# Building and launching Steam
## Create 32bit image
Create 32-bit Ubuntu 16.04 LTS (xenial) image
```
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
```
## Build Steam Docker image
You may want to re-run this command later on in order to keep the image updated.
```
docker build -t andrey01/steam .
```
## Launch the Steam in Docker
You can drop the following aliases to your ~/.bash_aliases
```
alias docker="sudo docker"
alias docker-compose="sudo docker-compose"
alias steam="docker-compose -f $HOME/docker/steam/docker-compose.yml run --rm steam"
```
Then just issue "steam" command to run Steam in docker.
## Troubleshooting
You might want to modify the `docker-compose.yml` in case of problems, the file should be pretty self explanatory, although you may refer to the official [Docker Compose file reference](https://docs.docker.com/compose/compose-file/)
Also keep in mind to uncomment or/and add your devices to the `devices:` section there.
The best result is when you have a similar to the following output, using the `glxgears` (part of `mesa-utils` package):
```
$ docker-compose -f $HOME/docker/steam/docker-compose.yml run --rm --entrypoint glxgears steam
Running synchronized to the vertical refresh. The framerate should be
approximately the same as the monitor refresh rate.
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:
```
$ docker-compose -f $HOME/docker/steam/docker-compose.yml run --rm steam --reset
```
# Links
Below is just bunch of links, someone might find them useful
- https://wiki.ubuntu.com/Valve
- https://developer.valvesoftware.com/wiki/Steam_under_Linux#Ubuntu
- http://media.steampowered.com/client/installer/steam.deb
- http://repo.steampowered.com/steam/archive/precise/steam_latest.deb
- http://repo.steamstatic.com/steam/

@ -0,0 +1,36 @@
# docker-compose run --rm steam
#
# alias docker="sudo -E docker"
# alias docker-compose="sudo -E docker-compose"
# alias steam="docker-compose -f /home/arno/docker/steam/docker-compose.yml run --rm steam"
version: '2'
volumes:
data: {}
services:
steam:
image: andrey01/steam
network_mode: bridge
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:ro
- /etc/localtime:/etc/localtime:ro
- /etc/machine-id:/etc/machine-id:ro
- $XDG_RUNTIME_DIR/pulse:/run/user/1000/pulse
- /dev/shm:/dev/shm
- data:/home
# - /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro
devices:
# - /dev/nvidia0
# - /dev/nvidiactl
# - /dev/nvidia-uvm
# - /dev/nvidia-modeset
- /dev/dri
# - /dev/snd
environment:
- DISPLAY=unix$DISPLAY
- PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native
# docker build -t steam .
# docker run --rm -ti -v /tmp/.X11-unix:/tmp/.X11-unix:ro -v /etc/localtime:/etc/localtime:ro -v /etc/machine-id:/etc/machine-id:ro -v /run/user/1000/pulse:/run/user/1000/pulse -v /dev/shm:/dev/shm --device /dev/dri -v $PWD/package:/home/user/.local/share/Steam/package -e DISPLAY=unix$DISPLAY -e PULSE_SERVER=unix:/run/user/1000/pulse/native steam

@ -0,0 +1,7 @@
#!/bin/sh
set -x
# Test whether NVIDIA's libGL.so.1 is working and if it doesn't work,
# fallback to free implementation of the OpenGL API (libgl1-mesa-glx)
glxinfo >/dev/null 2>&1 || export LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/mesa
steam $@
Loading…
Cancel
Save