LXC Game Server

Hello Guys,
I am runing a game server on KVM, i fidn some times hard to resize qcow2 and then the filesystem afterward, i have been using LXC for a while as webserver all good i can say.
Since this is going to be a huge step for me, I want to ask has anyone created a game server on lxc? would you recommend it? why? why not?
Thank you.

Can’t speak for purely LXC but using LXD I’ve created a couple of minecraft servers using CentOS 7 containers without issue before.

The main thing to keep in mind is the requirements for the game server you want to run since containers don’t have everything installed that a full OS install on Physical Hardware or a VM has for obvious reasons so you will need to often handle those bits yourself.

You should be fine, coming from a full virtualization platform bear in mind that you will have direct access to the hardware without limits by default. You might want to create some specific configurations to limit the amount of cpu / processes / memory that a container can use.

Hey. Your are right. Installing these requirements would be just like installing any other packages though . And i think that would be ok. Have you tried CSGO or Frontnite?

1 Like

That is so true. Is it bad idea to just not limit anything and let the game server use what ever resources it needs? Under what situation that would be necessary to do the limitation you think?

I would limit the amount of processes that a user can spawn, and probably limit the number of cpus available to the container to be the total of cpus available on the host -1 or -2 so that the host has some space to breathe in case something crazy happens on the container.

Ok. I think i am going to give it a try. If you guys wish to add anything. Now is the time.

Correct it’s just something to be aware of as it can catch some people out.
I have not tried either of those so far.

Give it a go and report back how things went :grin:

If you have more than public IPs, you can setup directly a public IP to a specific container.

You can use iptables to give network access to the containers. You can also use a LXD proxy device (UDP to UDP), though it might have somewhat bigger latency than iptables.

Yes, will do, just started now :slight_smile:

Yes, i do ahve more public ips, i read somewhere can not remember though, that setting the container lxc to use lxc.network.type = macvlan lxc.network.macvlan.mode = bridge lxc.network.hwaddr = will be best on performance and speed for public ips of a container lxc, is not that right?
#2 i can not wrape my head arround how to limit process on a lxc, say will run game server my case, what process limitation should go with?
$3 my host already on centos and will do lxc container of centos too, hope that will not cause me any troubles, i have already met the dependencies requirements though.

Hi @all
While setup, i ahde couple of issues,
#1 permissions denied while creating a container, after a lot of googling i run this script as root with first argument as lxcuser and pid number then

echo 1 > /sys/fs/cgroup/cpuset/cgroup.clone_children
for cgroup in /sys/fs/cgroup/*; do
   mkdir -p ${cgroup}/user.slice/user-$(id -u ${1}).slice
   chown -R $(id -u ${1}):$(id -g ${1}) ${cgroup}/user.slice/user-$(id -u ${1}).slice

   if [ "$(basename ${cgroup})" != "unified" ]; then
       echo ${2} > ${cgroup}/user.slice/user-$(id -u ${1}).slice/tasks

that seemed to fix the creation issue.
#2 can not start the container with error
```lxc-start: network.c: lxc_create_network_unpriv: 2443 Networks of type macvlan are not supported by unprivileged containers```
dose that mean , i can not run unprivileged container with `macvlan` ?