CM2Walki / CSGO

Dockerfile for automated build of a CS:GO gameserver: https://hub.docker.com/r/cm2network/csgo/
https://CM2.Network
MIT License
249 stars 74 forks source link

Cannot connect to Server with Windows host #27

Closed t-h-e closed 4 years ago

t-h-e commented 4 years ago

When running the container on linux everything is fine. On windows, --net=host is not supported.

So I tried a different approach and only published the ports I need. -p 27015:27015/udp -p 27015:27015/tcp.

On linux this works as well. I can connect and control the server with rcon. On windows I finally see the server listed, but I cannot connect.

Does anyone know what the issue could be or how to get the container to run on a windows host? I would have expected that a container should run on linux and windows in the same way

Side note: I do not pass SRCDS_TOKEN, but that should not change anything.

CM2Walki commented 4 years ago

Side note: I do not pass SRCDS_TOKEN, but that should not change anything.

If you don't, then connections will be restricted to LAN only. Make sure to keep that in mind. So if the server is hosted on a public IP you won't be able to connect.

Given the comment, I assume that you are aware of that though.

I'm not knowledgeable about Docker for Windows, so I can't really help you further. However, if you manage to find the solution let me know :)!

t-h-e commented 4 years ago

Yeah, I'm aware that the connections are restricted to LAN. I was actually just trying to use the container for a LAN setup.

I am not completely sure how windows runs docker, but the networking to connect to the containers is definitely different to linux. I tried updating windows to have WSL 2 support, as I thought that would change the networking, but the container seems to run in a completely different network, which makes it not possible to run a LAN setup with csgo in a container.

When setting the SRCDS_TOKEN everything works fine, when publishing the port 27015 on windows.

Anyway, thanks for the container 😃

PS: Maybe a question for another thread: Why add the following commandline argument: -v /home/steam/csgo-dedicated/? Seems to work with and without it.

CM2Walki commented 4 years ago

@t-h-e Glad it works on Windows using the token! It's very likely because srcds doesn't detect the docker bridge as a private network for whatever reason (probably some sort of pattern matching that's failing).

PS: Maybe a question for another thread: Why add the following commandline argument: -v /home/steam/csgo-dedicated/? Seems to work with and without it.

Yes, it works without but it's a horrible idea not to use a volume, since the data has to be downloaded first. That would mean you would be saving every change into a separate layer using the selected storage driver (usually overlay2). The initial game server download & successive updates would keep adding more and more layers, ballooning the container more and more.

The rule of thumb is: Data that changes a lot (for example database) -> volume Application that remains the same (static webserver) -> storage driver