Hackebein / docker-garrysmod

Dockerfiles for Garry's Mod
https://hub.docker.com/r/hackebein/garrysmod/
28 stars 2 forks source link

Can't connect to server on localhost (windows) #13

Closed describe19 closed 3 years ago

describe19 commented 3 years ago

Sorry I'm asking for support, not an issue. I'm running this on docker on Windows and I can't connect to the server - I see it in 'browse local games' but whenever I try to connect I get the failed after 6 retries. I'm on Windows 10 using WSL 2 backend, disabled windows firewall.

I've tried in the garrys mod console to connect via 127.0.0.1, my local 192.168.1.x address and my public ip address, also by clicking on the server in the local browser - I get the same failed after 6 retries message every way.

docker-compose.yml:

version: '3.3'
services:
    garrysmod:
        ports:
            - '27015:27015/tcp'
            - '27015:27015/udp'
        environment:
            - AUTHKEY=...
            - GAMEMODE=murder
            - MAP=cs_office
            - WORKSHOP=2530469034
            - WORKSHOPDL=247622320
        volumes:
            - './server.cfg:/opt/steam/garrysmod/cfg/server.cfg'
            - './overlay:/opt/overlay'
        image: hackebein/garrysmod
        stdin_open: true
        tty: true

server.cfg is empty

Container output:

Redirecting stderr to '/opt/steam/Steam/logs/stderr.txt'
/tmp/dumps insufficient permissions - delete and recreate
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam API...OK.

Connecting anonymously to Steam Public...Logged in OK
Waiting for user info...OK
 Update state (0x5) verifying install, progress: 0.18 (4196506 / 2288547467)
 Update state (0x5) verifying install, progress: 11.89 (272059968 / 2288547467)
 Update state (0x5) verifying install, progress: 26.47 (605819831 / 2288547467)
 Update state (0x5) verifying install, progress: 41.12 (941159429 / 2288547467)
 Update state (0x5) verifying install, progress: 55.79 (1276857242 / 2288547467)
 Update state (0x5) verifying install, progress: 70.29 (1608712782 / 2288547467)
 Update state (0x5) verifying install, progress: 84.56 (1935188926 / 2288547467)
 Update state (0x5) verifying install, progress: 97.15 (2223434634 / 2288547467)
Warning: failed to init SDL thread priority manager: SDL not found
 Update state (0x61) downloading, progress: 0.81 (378188 / 46492709)
 Update state (0x61) downloading, progress: 17.69 (8223357 / 46492709)
 Update state (0x61) downloading, progress: 17.69 (8223357 / 46492709)
 Update state (0x61) downloading, progress: 50.04 (23263896 / 46492709)
 Update state (0x81) verifying update, progress: 78.70 (36587869 / 46492709)
Success! App '232330' fully installed.
Redirecting stderr to '/opt/steam/Steam/logs/stderr.txt'
[  0%] Checking for available updates...
[----] Verifying installation...
Steam Console Client (c) Valve Corporation
-- type 'quit' to exit --
Loading Steam API...OK.

Connecting anonymously to Steam Public...Logged in OK
Waiting for user info...OK
 Update state (0x5) verifying install, progress: 0.00 (150333 / 3982117999)
 Update state (0x5) verifying install, progress: 5.73 (228182992 / 3982117999)
 Update state (0x5) verifying install, progress: 14.19 (564945879 / 3982117999)
 Update state (0x5) verifying install, progress: 22.42 (892714768 / 3982117999)
 Update state (0x5) verifying install, progress: 29.65 (1180498976 / 3982117999)
 Update state (0x5) verifying install, progress: 38.10 (1517326618 / 3982117999)
 Update state (0x5) verifying install, progress: 46.64 (1857269642 / 3982117999)
Warning: failed to init SDL thread priority manager: SDL not found
 Update state (0x5) verifying install, progress: 55.09 (2193559843 / 3982117999)
 Update state (0x5) verifying install, progress: 63.56 (2530881211 / 3982117999)
 Update state (0x5) verifying install, progress: 71.99 (2866917380 / 3982117999)
 Update state (0x5) verifying install, progress: 80.42 (3202238557 / 3982117999)
 Update state (0x5) verifying install, progress: 88.86 (3538390499 / 3982117999)
 Update state (0x5) verifying install, progress: 97.07 (3865635855 / 3982117999)
 Update state (0x61) downloading, progress: 0.00 (0 / 53344519)
 Update state (0x61) downloading, progress: 14.92 (7959386 / 53344519)
 Update state (0x61) downloading, progress: 70.50 (37606935 / 53344519)
Success! App '4020' fully installed.
Try to created GLST
Created GLST: B9BAB01785A610E5B451D6AAB950374C (1a190551f79c) for APPID 4000

************** WARNING ***************
Running the dedicated server as root  
is highly discouraged. It is generally
unnecessary to use root privileges to 
execute the dedicated server.         
**************************************

The server will continue to launch in 10 seconds
The server will continue to launch in 9 seconds
The server will continue to launch in 8 seconds
The server will continue to launch in 7 seconds
The server will continue to launch in 6 seconds
The server will continue to launch in 5 seconds
The server will continue to launch in 4 seconds
The server will continue to launch in 3 seconds
The server will continue to launch in 2 seconds
The server will continue to launch in 1 seconds
Auto detecting CPU
Using default binary: ./srcds_linux
Server will auto-restart if there is a crash.
mount.cfg adding path: '/opt/steam/Steam'
mount.cfg adding path: '/opt/steam/cstrike'
mount.cfg adding path: '/opt/steam/hl2'
Couldn't load shader dll: game_shader_generic_garrysmod_srv.soConVarRef mat_dxlevel doesn't point to an existing ConVar
Game_srv.so loaded for "Garry's Mod"
Setting breakpad minidump AppID = 4000
Initializing Steam libraries for Workshop..
[S_API] SteamAPI_Init(): Loaded local 'steamclient.so' OK.
CAppInfoCacheReadFromDiskThread took 3 milliseconds to initialize
CApplicationManagerPopulateThread took 0 milliseconds to initialize (will have waited on CAppInfoCacheReadFromDiskThread)
RecordSteamInterfaceCreation (PID 146): SteamGameServer013 / 
RecordSteamInterfaceCreation (PID 146): SteamUtils010 / 
RecordSteamInterfaceCreation (PID 146): SteamGameServer013 / 
RecordSteamInterfaceCreation (PID 146): SteamUtils010 / 
RecordSteamInterfaceCreation (PID 146): SteamNetworking006 / 
RecordSteamInterfaceCreation (PID 146): SteamGameServerStats001 / 
RecordSteamInterfaceCreation (PID 146): STEAMHTTP_INTERFACE_VERSION003 / 
RecordSteamInterfaceCreation (PID 146): STEAMINVENTORY_INTERFACE_V003 / 
RecordSteamInterfaceCreation (PID 146): STEAMUGC_INTERFACE_VERSION014 / 
RecordSteamInterfaceCreation (PID 146): STEAMAPPS_INTERFACE_VERSION008 / 
[S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded.
RecordSteamInterfaceCreation (PID 146): SteamGameServer013 / 
RecordSteamInterfaceCreation (PID 146): SteamUtils010 / 
RecordSteamInterfaceCreation (PID 146): SteamNetworking006 / 
RecordSteamInterfaceCreation (PID 146): SteamGameServerStats001 / 
RecordSteamInterfaceCreation (PID 146): STEAMHTTP_INTERFACE_VERSION003 / 
RecordSteamInterfaceCreation (PID 146): STEAMINVENTORY_INTERFACE_V003 / 
RecordSteamInterfaceCreation (PID 146): STEAMUGC_INTERFACE_VERSION014 / 
RecordSteamInterfaceCreation (PID 146): STEAMAPPS_INTERFACE_VERSION008 / 
-authkey is no longer required by Garry's Mod. You can safely remove it from your server's launch options.
RecordSteamInterfaceCreation (PID 146): STEAMUGC_INTERFACE_VERSION014 / UGC
RecordSteamInterfaceCreation (PID 146): SteamGameServer013 / GameServer
WS: Waiting for Steam to log us in......
WS: Fetching collection info...
Processing collection 2530469034...
RecordSteamInterfaceCreation (PID 146): SteamUtils010 / Utils
   Collection 'Mechanical Minds Murder' (5 items)
   Retrieving item details...
   5 new addon(s)
WS: Finished!

WS: Processing 5 addons...
Processing addon 5: de_forest (106821161)...
   Mounted!
Processing addon 4: House With Garden v2 (160586516)...
   Mounted!
Processing addon 3: md_clue (217808514)...
   Mounted!
Processing addon 2: Murder (187073946)...
   Mounted!
Processing addon 1: MU_Nightmare_Church - [Official Murder Gamemode Map Support!] - 14th July 2014 - Final (225468579)...
   Mounted!
WS: Finished!
Could not find steamerrorreporter binary. Any minidumps will be uploaded in-processUnknown command "cl_cmdrate"
Unknown command "cl_updaterate"
Unknown command "rate"
Changing gamemode to Murder (murder)
Network: IP 172.18.0.2, mode MP, dedicated Yes, ports 27015 SV / 27005 CL
PREP OK
Making workshop gamemode available for client download
ConVarRef room_type doesn't point to an existing ConVar
Executing dedicated server config file server.cfg
Using map cycle file cfg/mapcycle.txt.
Attempted to create unknown entity type info_ladder!
Attempted to create unknown entity type hostage_entity!
Attempted to create unknown entity type hostage_entity!
Attempted to create unknown entity type hostage_entity!
Attempted to create unknown entity type hostage_entity!
Attempted to create unknown entity type info_ladder!
Attempted to create unknown entity type func_buyzone!
Attempted to create unknown entity type func_buyzone!
Attempted to create unknown entity type func_hostage_rescue!
Attempted to create unknown entity type func_hostage_rescue!
Initializing Steam libraries for secure Internet server
[S_API] SteamAPI_Init(): Loaded local 'steamclient.so' OK.
CAppInfoCacheReadFromDiskThread took 4 milliseconds to initialize
CApplicationManagerPopulateThread took 0 milliseconds to initialize (will have waited on CAppInfoCacheReadFromDiskThread)
RecordSteamInterfaceCreation (PID 146): SteamGameServer013 / 
RecordSteamInterfaceCreation (PID 146): SteamUtils010 / 
RecordSteamInterfaceCreation (PID 146): SteamGameServer013 / 
RecordSteamInterfaceCreation (PID 146): SteamUtils010 / 
RecordSteamInterfaceCreation (PID 146): SteamNetworking006 / 
RecordSteamInterfaceCreation (PID 146): SteamGameServerStats001 / 
RecordSteamInterfaceCreation (PID 146): STEAMHTTP_INTERFACE_VERSION003 / 
RecordSteamInterfaceCreation (PID 146): STEAMINVENTORY_INTERFACE_V003 / 
RecordSteamInterfaceCreation (PID 146): STEAMUGC_INTERFACE_VERSION014 / 
RecordSteamInterfaceCreation (PID 146): STEAMAPPS_INTERFACE_VERSION008 / 
Logging into Steam game server account
RecordSteamInterfaceCreation (PID 146): SteamGameServer013 / 
RecordSteamInterfaceCreation (PID 146): SteamUtils010 / 
RecordSteamInterfaceCreation (PID 146): SteamNetworking006 / 
RecordSteamInterfaceCreation (PID 146): SteamGameServerStats001 / 
RecordSteamInterfaceCreation (PID 146): STEAMHTTP_INTERFACE_VERSION003 / 
RecordSteamInterfaceCreation (PID 146): STEAMINVENTORY_INTERFACE_V003 / 
RecordSteamInterfaceCreation (PID 146): STEAMUGC_INTERFACE_VERSION014 / 
RecordSteamInterfaceCreation (PID 146): STEAMAPPS_INTERFACE_VERSION008 / 
Connection to Steam servers successful.
   Public IP is i.removed.my.ip.
Assigned persistent gameserver Steam ID [G-1:4361038].
VAC secure mode is activated.

Any ideas?

Hackebein commented 3 years ago

Hi, i can't finde the issue anymore but there was somebody in the past with the same setup and same problem. The problem ist that WSL 2 doesn't forward UDP ports by default. You have to forward the ports manually or connect to the real IP of your docker host.

describe19 commented 3 years ago

What do you mean by 'connect to the real IP of your docker host'

Hackebein commented 3 years ago

I'm assuming in your case that Docker is running on WSL 2. WSL 2 is similar to a VM. This VM has a different IP address. To get the IP of my WSL VM i'm running wsl ip addr show eth0

wsl ip addr show eth0 5: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:15:5d:2a:05:d8 brd ff:ff:ff:ff:ff:ff inet 172.30.207.85/20 brd 172.30.207.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::215:5dff:fe2a:5d8/64 scope link valid_lft forever preferred_lft forever

Maybe there is a different way to use Docker with WSL but that is the way that i know.

I heard that there are other solutions. For example UDP port forwards but this is only working with windows firewall as far as i know. (And might be not a solution for you because your firewall is turned off)

describe19 commented 3 years ago

Okay yes, connecting to that WSL VM address works, now how do I do UDP port forwards with windows firewall? I thought it was only capable of allow/deny behaviour?

Hackebein commented 3 years ago

now how do I do UDP port forwards with windows firewall?

There are many users having issues with that and from what i remember there is no universal solution for that. Also the whole issue has nothing to do with this docker image. Also I'm not a WSL/WSL2 expert. I would recommend to give it a research from your own side.

describe19 commented 3 years ago

All good thanks for your help