Running game servers with Docker?

Running game servers with Docker?

Postby Julius » 04 Feb 2018, 15:55

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.
“You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete” - Buckminster Fuller
User avatar
Julius
Community Moderator
 
Posts: 2170
Joined: 06 Dec 2009, 14:02

Re: Running game servers with Docker?

Postby Lyberta » 06 Feb 2018, 14:31

I've started to look into it for sandboxing but after finding that it is very hard to force all traffic to go through Tor, I stopped researching for now.
Mental health warning.
User avatar
Lyberta
 
Posts: 387
Joined: 19 Jun 2013, 10:45

Re: Running game servers with Docker?

Postby sago007 » 06 Feb 2018, 22:20

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.
sago007
 
Posts: 4
Joined: 16 Jul 2017, 10:06

Re: Running game servers with Docker?

Postby Julius » 07 Feb 2018, 18:13

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?
“You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete” - Buckminster Fuller
User avatar
Julius
Community Moderator
 
Posts: 2170
Joined: 06 Dec 2009, 14:02

Re: Running game servers with Docker?

Postby sago007 » 08 Feb 2018, 20:12

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.
sago007
 
Posts: 4
Joined: 16 Jul 2017, 10:06

Re: Running game servers with Docker?

Postby hagish » 09 Mar 2018, 11:56

There is also an interesting articles series on gamasutra that runs gameserver on kubernetes.

https://www.gamasutra.com/blogs/MarkMan ... loying.php
User avatar
hagish
Global Moderator
 
Posts: 63
Joined: 08 Nov 2009, 22:53

Re: Running game servers with Docker?

Postby Julius » 15 Mar 2018, 15:55

Looks like Google did some work on it too:
https://cloudplatform.googleblog.com/20 ... s.html?m=1
“You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete” - Buckminster Fuller
User avatar
Julius
Community Moderator
 
Posts: 2170
Joined: 06 Dec 2009, 14:02

Who is online

Users browsing this forum: No registered users and 1 guest