2 ms·
There was that time the Steam client rm-rf'd your home directory because of a typo in its wrapper shell script. Also, the client itself requires a bunch of pack
by Arnavion 7y ago
There was that time the Steam client rm-rf'd your home directory because of a typo in its wrapper shell script. Also, the client itself requires a bunch of packages that I'd rather not install on my machine, because my distro packages don't match what it wants, and because some of the packages it wants are 32-bit ones.
So I just run Steam itself in a Docker container. The home directory inside the container is mounted to a subdirectory of my home on the host, so even if Steam wipes everything from it the only thing I'd lose is Steam itself.
- crummy 7y agoI didn't know you could run graphical apps in Docker. How does that work?
- Arnavion 7y agorm -f ~/docker-games/root/.Xauthority touch ~/docker-games/root/.Xauthority xauth nlist "$DISPLAY" | sed -e 's/^..../ffff/' | xauth -f ~/docker-games/root/.Xauthority nmerge - chmod 0444 ~/docker-games/root/.Xauthority XSOCK="$(realpath /tmp/.X11-unix/*)" DBUS_SESSION_BUS_PATH="$(echo "$DBUS_SESSION_BUS_ADDRESS" | sed -e 's/^unix:path=//')" docker run -it --rm \ --device '/dev/dri:/dev/dri' \ -v "$XSOCK:$XSOCK" \ -v "$(realpath ~/docker-games/root):/home/arnavion" \ -v "$(realpath ~/.config/pulse/cookie):/home/arnavion/.config/pulse/cookie" \ -v "$DBUS_SESSION_BUS_PATH:$DBUS_SESSION_BUS_PATH" \ -e "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" \ -e "DISPLAY=$DISPLAY" \ -e "PULSE_SERVER=$(ip -4 addr show enp4s0 | grep -Po 'inet \K[^/]+'):4713" \ -e 'XAUTHORITY=/home/arnavion/.Xauthority' \ --shm-size '1G' \ --hostname arnavion-docker-games \ docker-games \ $COMMAND The XSOCK mount allows it to talk to the host X server, and the .Xauthority mount allows it to auth with the host X server. Apart from that: * ~/docker-games/root is the home directory inside the container. * The DBUS mount and env var is to allow Steam to show its icon in the system tray of the host DE. There's also a symlink for `~/.steam/public/steam_tray_mono.png` -> `~/docker-games/root/.steam/public/steam_tray_mono.png` so that the host DE can find the icon based on the path inside the container. * The pulseaudio mount and env var is to allow sound. It requires pulseaudio to be set up to allow network clients. Here's the full gist: https://gist.github.com/Arnavion/3212232d0761d49d9636f796c5a99e53 https://gist.github.com/Arnavion/3212232d0761d49d9636f796c5a...