Games on Docker

Hello there , is there is a way to deploy/play a game on a docker container
OS -> win 7 64

On Linux, you could pass in your graphical device and run UI-apps (including games) inside a container that use a remote x-server or mounted x11-daemon socket to render the output.

I am neither sure if the --device option is even usable for Windows, nor how the value to pass in the graphic device would look like. On Linux things are pretty straigt forward.

Don’t know if this is exactly what you are referring but I use Windows and have recently been using a Docker container based on Fedora for a programming language development machine. Yes I know that a Docker container is to be stateless and this is not what one should do, it is a stepping stone for learning more about Docker. The programming language has a few tools that use X-windows. So to use those tools a Windows X-Windows server is installed, e.g. VcXsrv Windows X Server. Then in the container add this to the end of the .bashrc file.

export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0

then restart the .bashrc file with

. ~/.bashrc

Also the Windows X-windows server needs to be started before starting the Linux app and all of the appropriate firewall rules set to allow the packets to flow.

All of this comes from working with WSL 2. I only learned enough about this to get it to work, so don’t expect me to be able to answer questions.


1 Like