base-x32
,latest-x32
,base
,latest
(bookworm/x32/Dockerfile)metamod-x32
,metamod
(bookworm/x32/Dockerfile)sourcemod-x32
,sourcemod
(bookworm/x32/Dockerfile)base-x64
, (bookworm/x64/Dockerfile)metamod-x64
(bookworm/x64/Dockerfile)sourcemod-x64
(bookworm/x64/Dockerfile)
Nine distinct classes provide a broad range of tactical abilities and personalities. Constantly updated with new game modes, maps, equipment and, most importantly, hats! This Docker image contains the dedicated server of the game.
Running on the host interface (recommended):
$ docker run -d --net=host --name=tf2-dedicated -e SRCDS_TOKEN={YOURTOKEN} cm2network/tf2
Running using a bind mount for data persistence on container recreation:
$ mkdir -p $(pwd)/tf2-data
$ chmod 777 $(pwd)/tf2-data # Makes sure the directory is writeable by the unprivileged container user
$ docker run -d --net=host -v $(pwd)/tf2-data:/home/steam/tf-dedicated/ --name=tf2-dedicated -e SRCDS_TOKEN={YOURTOKEN} cm2network/tf2
Running multiple instances (increment SRCDS_PORT and SRCDS_TV_PORT):
$ docker run -d --net=host --name=tf2-dedicated2 -e SRCDS_PORT=27016 -e SRCDS_TV_PORT=27021 -e SRCDS_TOKEN={YOURTOKEN} cm2network/tf2
SRCDS_TOKEN
is required to be listed & reachable. Generate one here using AppID 440
:
https://steamcommunity.com/dev/managegameservers
SRCDS_WORKSHOP_AUTHKEY
is required to use workshop features:
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 (AppID 440): https://steamcommunity.com/dev/managegameservers)
SRCDS_RCONPW="changeme" (value can be overwritten by tf/cfg/server.cfg)
SRCDS_PW="changeme" (value can be overwritten by tf/cfg/server.cfg)
SRCDS_PORT=27015
SRCDS_TV_PORT=27020
SRCDS_IP="0" (local ip to bind)
SRCDS_FPSMAX=300
SRCDS_TICKRATE=66
SRCDS_MAXPLAYERS=14
SRCDS_REGION=3
SRCDS_STARTMAP="ctf_2fort"
SRCDS_HOSTNAME="New TF Server" (first launch only)
SRCDS_WORKSHOP_AUTHKEY="" (required to load workshop maps)
SRCDS_CFG="server.cfg"
SRCDS_MAPCYCLE="mapcycle_default.txt" (value can be overwritten by tf/cfg/server.cfg)
SRCDS_SECURED=1 (0 to start the server as insecured)
The image contains static copies of the competitive config files from UGC League and RGL.gg.
You can edit the config using this command:
$ docker exec -it tf2-dedicated nano /home/steam/tf-dedicated/tf/cfg/server.cfg
Or if you want to explicitly specify a server config file, use the SRCDS_CFG
environment variable.
If you want to learn more about configuring a TF2 server check this documentation.
The tf2
images come in three flavors, each designed for a specific use case, with a 64-bit version if needed.
This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is a bare-minimum TF2 dedicated server containing no 3rd party plugins.
This is a specialized image. It contains the plugin environment Metamod:Source which can be found in the addons directory. You can find additional plugins here.
This is another specialized image. It contains both Metamod:Source and the popular server plugin SourceMod which can be found in the addons directory. SourceMod supports a wide variety of additional plugins that can be found here.
A 64-bit version of all three variants, i.e. latest-x64
, metamod-x64
, and sourcemod-x64
. This will run a fully 64-bit server, srcds_linux64
, with a 64-bit version of Metamod or SourceMod.
If you require SourceMod and aren't fully sure whether your plugins work on 64-bit servers, it's better to use the normal 32-bit variant, tf2:sourcemod
. If you want to run a server without any plugins, tf2:latest-x64
is preferred.