joedwards32 / CS2

CS2 Dedicated Server Docker Image
https://hub.docker.com/r/joedwards32/cs2
MIT License
270 stars 53 forks source link

Error when running the docker-compose #118

Closed mathiasHillmann closed 2 months ago

mathiasHillmann commented 3 months ago

I have the following docker-compose:

version: '3.7'
services:
  cs2-server:
    image: joedwards32/cs2
    container_name: cs2-dedicated
    environment:
      # Server configuration
      - SRCDS_TOKEN=[REDACTED]      # Game Server Token from https://steamcommunity.com/dev/managegameservers
      - STEAMAPPVALIDATE=0          # (0 - no validation, 1 - enable validation)
      - CS2_SERVERNAME=[REDACTED]   # (Set the visible name for your private server)
      - CS2_CHEATS=0                # (0 - disable cheats, 1 - enable cheats)
      - CS2_PORT=27015              # (CS2 server listen port tcp_udp)
      - CS2_SERVER_HIBERNATE=0      # (Put server in a low CPU state when there are no players. 0 - hibernation disabled, 1 - hibernation enabled)
      - CS2_RCON_PORT               # (Optional, use a simple TCP proxy to have RCON listen on an alternative port. Useful for services like AWS Fargate which do not support mixed protocol ports.)
      - CS2_LAN=0                   # (0 - LAN mode disabled, 1 - LAN Mode enabled)
      - CS2_RCONPW=[REDACTED]       # (RCON password)
      - CS2_PW=                     # (CS2 server password)
      - CS2_MAXPLAYERS=16           # (Max players)
      - CS2_ADDITIONAL_ARGS         # (Optional additional arguments to pass into cs2)
      - CS2_CFG_URL                 # HTTP/HTTPS URL to fetch a Tar Gzip bundle of configuration files/mods
      # Game modes
      - CS2_GAMEALIAS=casual        # (Game type, e.g. casual, competitive, deathmatch. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers)
      - CS2_GAMETYPE=0              # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers)
      - CS2_GAMEMODE=0              # (Used if CS2_GAMEALIAS not defined. See https://developer.valvesoftware.com/wiki/Counter-Strike_2/Dedicated_Servers)
      - CS2_MAPGROUP=mg_active      # (Map pool)
      - CS2_STARTMAP=de_inferno     # (Start map)
      # Bots
      - CS2_BOT_DIFFICULTY          # (0 - easy, 1 - normal, 2 - hard, 3 - expert)
      - CS2_BOT_QUOTA               # (Number of bots)
      - CS2_BOT_QUOTA_MODE          # (fill, competitive)
      # TV
      - TV_AUTORECORD=0             # Automatically records all games as CSTV demos: 0=off, 1=on.
      - TV_ENABLE=0                 # Activates CSTV on server: 0=off, 1=on.
      - TV_PORT=27020               # Host SourceTV port
      - TV_PW=[REDACTED]            # CSTV password for clients
      - TV_RELAY_PW=[REDACTED]      # CSTV password for relay proxies
      - TV_MAXRATE=0                # World snapshots to broadcast per second. Affects camera tickrate.
      - TV_DELAY=0                  # Max CSTV spectator bandwidth rate allowed, 0 == unlimited
      # Logs
      - CS2_LOG=on                  # 'on'/'off'
      - CS2_LOG_MONEY=0             # Turns money logging on/off: (0=off, 1=on)
      - CS2_LOG_DETAIL=0            # Combat damage logging: (0=disabled, 1=enemy, 2=friendly, 3=all)
      - CS2_LOG_ITEMS=0             # Turns item logging on/off: (0=off, 1=on)
    volumes:
      - cs2:/home/steam/cs2-dedicated/  # Persistent data volume mount point inside container
    ports:
      - "27015:27015/tcp"           # TCP
      - "27015:27015/udp"           # UDP
      - "27020:27020/udp"           # UDP
    stdin_open: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated
    tty: true # Add local console for docker attach, docker attach --sig-proxy=false cs2-dedicated
volumes:
  cs2:

And while creating the container no errors appear:

steam@bla:/servers/cs2$ docker-compose up -d
Creating network "cs2_default" with the default driver
Creating volume "cs2_cs2" with default driver
Creating cs2-dedicated ... done

But the container instantly exits with the message:

steam@bla:/servers/cs2$ docker logs cs2-dedicated
exec /usr/bin/bash: no such file or directory

What am I doing wrong?

joedwards32 commented 3 months ago

I'm not sure. Compose looks OK.

Can you clear out the docker image you have downloaded? docker images and docker rmi commands. Just to make sure you are using the latest image.

I presume if you run without the -d flag (i.e. attached) you get the same bash error immediately?

mathiasHillmann commented 3 months ago

I removed the cached image and volume and this is the result while running without -d:

steam@mixed:/servers/cs2$ docker-compose up
Creating volume "cs2_cs2" with default driver
Pulling cs2-server (joedwards32/cs2:)...
latest: Pulling from joedwards32/cs2
09f376ebb190: Pull complete
d8997d50f84b: Pull complete
4f4fb700ef54: Pull complete
23e4c21e0e4a: Pull complete
5308617ef2e0: Pull complete
b983151c419d: Pull complete
7fe9e314aa0e: Pull complete
70a1675d4c31: Pull complete
444c8d240377: Pull complete
Digest: sha256:4bf91cebfcfd83c172df821443548dd1f12269ac01b33518270d59c6abea7cd5
Status: Downloaded newer image for joedwards32/cs2:latest
Creating cs2-dedicated ... done
Attaching to cs2-dedicated
cs2-dedicated | exec /usr/bin/bash: no such file or directory
cs2-dedicated exited with code 1
joedwards32 commented 2 months ago

Very odd. Can you try without the persistent volume?

Remove the following from your config

    volumes:
      - cs2:/home/steam/cs2-dedicated/  # Persistent data volume mount point inside container
mathiasHillmann commented 2 months ago

I forgot to update this.

I have found out the reason for the odd error was that the VM i'm using is on ARM64 and this container was built for AMD64.