Search code examples
dockersteamsteamworks-api

Failed connecting to Steam in Docker using host network


I want to host dedicated steam servers for a multiplayer game I'm currently working on in docker containers.

My Dockerfile:

FROM ubuntu:22.04

RUN useradd -m steam
COPY --chown=steam:steam LinuxServer /home/steam/ 
COPY --chown=steam:steam steamclient.so /home/steam/.steam/sdk64/steamclient.so

USER steam 

WORKDIR /home/steam

CMD  ./Server.sh

My docker-compose.yml:

services:
  server:
    image: server
    network_mode: host

When starting the container, the dedicated server isn't able to logon to steam. In Steam/logs/connection_log.txt it reports OK messages:

[2022-10-11 10:04:10] Connectivity test: Starting test, fetching 'http://test.steampowered.com/204'
[2022-10-11 10:04:10] Connectivity test: OK!
[2022-10-11 10:04:10] Connectivity test: result=Connected (since 0.0s ago), prev=Unknown, in progress=0
[2022-10-11 10:04:22] Connectivity test: Starting test, fetching 'http://test.steampowered.com/204'
[2022-10-11 10:04:22] Connectivity test: OK!
[2022-10-11 10:04:22] Connectivity test: result=Connected (since 11.5s ago), prev=Unknown, in progress=0
[2022-10-11 10:04:23] Connectivity test: Starting test, fetching 'http://test.steampowered.com/204'
[2022-10-11 10:04:23] Connectivity test: OK!

However, in Steam/logs/connection_log_7777.txt it repeats the following errors:

[2022-10-11 10:04:10] IPv6 HTTP connectivity test (ipv6check-http.steamcontent.com / [2a01:bc80:8:103::9b85:fc12]:80 ([2a01:bc80:8:103::9b85:fc12]:80)) - TIMEOUT
[2022-10-11 10:04:12] IPv6 UDP connectivity test (ipv6check-udp.steamcontent.com / 2a01:bc80:a:100::b919:b604) - TIMEOUT
[2022-10-11 10:04:21] [0,0] SetSteamID( [G:1:0] )
[2022-10-11 10:04:21] CCMInterface::YieldingConnect -- calling ISteamDirectory/GetCMListForConnect web api
[2022-10-11 10:04:21] [0,0] SetSteamID( [G:1:0] )
[2022-10-11 10:04:21] GetCMListForConnect -- web API call failed (status = 0)
[2022-10-11 10:04:21] [0,0] PingWebSocketCM() (cm2-iad1.cm.steampowered.com.:443) starting...
[2022-10-11 10:04:21] [0,0] PingWebSocketCM() (cm2-lax1.cm.steampowered.com:27021) starting...
[2022-10-11 10:04:21] [0,0] PingWebSocketCM() (cm1-lax1.cm.steampowered.com:27021) starting...
[2022-10-11 10:04:21] [0,0] PingWebSocketCM() (cm2-iad1.cm.steampowered.com.:443) failed talking to cm (timeout/neterror - Invalid)
[2022-10-11 10:04:21] [0,0] PingWebSocketCM() (cm2-lax1.cm.steampowered.com:27021) failed talking to cm (timeout/neterror - Invalid)
[2022-10-11 10:04:21] [0,0] PingWebSocketCM() (cm1-lax1.cm.steampowered.com:27021) failed talking to cm (timeout/neterror - Invalid)
[2022-10-11 10:04:21] [1,3] Connect() starting connection (eNetQOSLevelMedium, cm2-iad1.cm.steampowered.com.:443, WebSocket)
[2022-10-11 10:04:21] [1,0] ConnectFailed('Connection Failed':0) (0.0.0.0:0, WebSocket)
[2022-10-11 10:04:21] [1,0] Client thinks it can connect via: UDP - yes, TCP - yes, WebSocket:443 - yes, WebSocket:Non443 - yes
[2022-10-11 10:04:21] [0,0] StartAutoReconnect() will start in 4.0 seconds (attempt 1)
[2022-10-11 10:04:22] [0,0] SetSteamID( [G:1:0] )

When starting the dedicated server on my local machine I don't have these problems. I would assume it would work the same in a docker container as I'm using the "host" network mode. Does anyone have any idea what I'm doing wrong here?

Any help is appreciated!


Solution

  • If someone ever has the same issue, I fixed it by adding the following commands to the Dockerfile:

    RUN apt-get update && \
        apt-get install -y openssl iproute2 ca-certificates && \
        apt-get clean