Dockerfile that builds a basic CSGO Server with Sourcemod and Metamod.
Running on the host interface (recommended):
$ docker run -d --net=host --name=csgo-dedicated -e SRCDS_TOKEN={YOURTOKEN} jonisj/csgo-sourcemod
Running using a bind mount for data persistence on container recreation:
$ mkdir -p $(pwd)/csgo-data
$ chmod 777 $(pwd)/csgo-data # Makes sure the directory is writeable by the unprivileged container user
$ docker run -d --net=host -v $(pwd)/csgo-data:/home/steam/csgo-dedicated/ --name=csgo-dedicated -e SRCDS_TOKEN={YOURTOKEN} jonisj/csgo-sourcemod
Running multiple instances (increment SRCDS_PORT and SRCDS_TV_PORT):
$ docker run -d --net=host --name=csgo-dedicated2 -e SRCDS_PORT=27016 -e SRCDS_TV_PORT=27021 -e SRCDS_TOKEN={YOURTOKEN} jonisj/csgo-sourcemod
SRCDS_TOKEN
is required to be listed & reachable; https://steamcommunity.com/dev/managegameservers
SRCDS_WORKSHOP_AUTHKEY
is required to use the workshop; https://steamcommunity.com/dev/apikey
It's also recommended to use "--cpuset-cpus=" to limit the game server to a specific core & thread.
The container will automatically update the game on startup, so if there is a game update just restart the container.
Feel free to overwrite these environment variables, using -e (--env):
SRCDS_TOKEN="changeme" (value is is required to be listed & reachable, retrieve token here: https://steamcommunity.com/dev/managegameservers)
SRCDS_RCONPW="changeme" (value can be overwritten by csgo/cfg/server.cfg)
SRCDS_PW="changeme" (value can be overwritten by csgo/cfg/server.cfg)
SRCDS_PORT=27015
SRCDS_TV_PORT=27020
SRCDS_NET_PUBLIC_ADDRESS="0" (public facing ip, useful for local network setups)
SRCDS_IP="0" (local ip to bind)
SRCDS_FPSMAX=300
SRCDS_TICKRATE=128
SRCDS_MAXPLAYERS=14
SRCDS_STARTMAP="de_dust2"
SRCDS_REGION=3
SRCDS_MAPGROUP="mg_active"
SRCDS_GAMETYPE=0
SRCDS_GAMEMODE=1
SRCDS_HOSTNAME="New CSGO Server"
SRCDS_WORKSHOP_START_MAP=0
SRCDS_HOST_WORKSHOP_COLLECTION=0
SRCDS_WORKSHOP_AUTHKEY="" (required to use host_workshop_map)
ADDITIONAL_ARGS="" (Pass additional arguments to srcds. Make sure to escape correctly!)
SOURCEMOD_ADMINS="" List of comma-separated Steam IDs that are SourceMod admins (e.g. STEAM_0:0:123,STEAM_0:1:234) with z flag.
SV_DOWNLOADURL="" (Your FastDL URL)
METAMOD_VERSION="1.11"
SOURCEMOD_VERSION="1.11"