Page 1 of 1

Running game servers with Docker?

PostPosted: 04 Feb 2018, 15:55
by Julius
Anyone has experience running game servers in a Docker environment?

Seems like a cool way to quickly install and turn on/off multiplayer game-servers and maybe even do some load balancing.

Docker is basically a Linux Chroot, so any game with an headless Linux server should theoretically work.

Re: Running game servers with Docker?

PostPosted: 06 Feb 2018, 14:31
by Lyberta
Deleted.

Re: Running game servers with Docker?

PostPosted: 06 Feb 2018, 22:20
by sago007
I have a couple of OpenArena servers running using my own image from https://hub.docker.com/r/sago007/openarena/

I can now launch a server from any machine having docker installed with
docker run -it -e "OA_STARTMAP=dm4ish" -e "OA_PORT=27960" --rm -p 27960:27960/udp sago007/openarena

I like that it is not more isolated than you want it to be. I mount /data form inside the docker image to a host folder, so that I can keep track of configuration and log files.
It is also easy to test on your own machine and then move the whole thing to production without having to worry about stuff breaking.

There are a few gotchas.
You need to change to a non-root user or it is possible to escape the jail. Newer versions of Docker does have an alternative but it has other weaknesses.
It is a new technology and it is already bloated. They had to add "COPY" to replace "ADD" because "ADD" was turning bad.
It requires some trickery to prevent the install file from staying in the image.

I also use Docker for CI builds. I always found it difficult to test dependencies for different target machines but Docker has made it a lot easier.
Now I have a clean target machine ready in seconds.
I also created a Docker image with MXE, so that I can cross compile to Windows without having to mess with installing anything to my local machine.
I use it to build binary releases with old libraries. Only trouble building releases is that it is lacking 32 bit support.

Re: Running game servers with Docker?

PostPosted: 07 Feb 2018, 18:13
by Julius
Ah, that sounds promising. I am still learning/experimenting with all this Docker ecosystem though...

How did you make the game server react to the environment variables? Do you need to make some specific translation layer for that?

Re: Running game servers with Docker?

PostPosted: 08 Feb 2018, 20:12
by sago007
I use a wrapper script that takes the environments and passes them as arguments to the executable. https://github.com/sago007/docker_opena ... _script.sh
It is quite simple.

I also rotate log files and do some first time setup. Both are optional and can be skipped if the server does not need persistent data.

If the server you are trying to dockerize only has a few arguments you might choose to set everything through the environments.

Re: Running game servers with Docker?

PostPosted: 09 Mar 2018, 11:56
by hagish
There is also an interesting articles series on gamasutra that runs gameserver on kubernetes.

https://www.gamasutra.com/blogs/MarkMan ... loying.php

Re: Running game servers with Docker?

PostPosted: 15 Mar 2018, 15:55
by Julius
Looks like Google did some work on it too:
https://cloudplatform.googleblog.com/20 ... s.html?m=1