This repo contains a Docker setup for automatically downloading, updating, and running a TF2 server.
Start by running touch server.env
. You can leave this file blank for now.
Run ./tf2.sh
to download and start the server. Once the download has completed, you should see the message >> Starting server
. If you're running this on your local machine you should also see the server appear under the LAN tab of the server browser.
The server volume is mounted to data/
. You'll probably want data/tf/
which has things like cfg
, maps
, etc.
./tf2.sh daemon
./tf2.sh console
# Or
./tf2.sh d
./tf2.sh c
This starts the server in daemon-mode and then attaches to the process in the container. Once attached you can type in console commands, such as sm version
if you have SourceMod installed.
NOTE: Because you are attaching directly to the server process, if you press CTRL-C
it will exit the server. To detach, press CTRL-A, D
.
You can customize the server startup options with a server.env
file. These are command line options used by SRCDS. For a full list of possible options see the wiki page.
SERVER_TOKEN
- A login token for your server, required by Steam. Get a login token here.
IP
- The IP to bind the server to. Leave this blank unless you know what you're doing. (default:
0.0.0.0
)
- The IP to bind the server to. Leave this blank unless you know what you're doing. (default:
PORT
- The port to bind the server to. (default:
27015
)
- The port to bind the server to. (default:
START_MAP
- The map to load when the server starts. (default:
ctf_2fort
)
- The map to load when the server starts. (default:
MAX_PLAYERS
- The maximum number of players for the server. (default: 16, max is 32)
VAC
- Enable/disable Valve Anti-Cheat. (default:
1
, use0
for insecure)
- Enable/disable Valve Anti-Cheat. (default:
DEBUG
- Enable/disable debugging. (default:
0
, use1
to enable)
- Enable/disable debugging. (default:
EXTRA
- Any extra command line options. These are appended to the end of the options before starting the server.
- The server crashes on startup and says to enable debugging for more info
- Open
docker/Dockerfile
and uncomment the debug section - Add
DEBUG=1
toserver.env
- Run
./tf2.sh
- Once you've solved the issue you can re-comment the debug section in the Dockerfile
- Open
- "There is no screen to be attached matching tf2." error when running
./tf2.sh console
- This usually means you pressed
CTRL-C
while attached in a previous console session and killed the server. - Run
./tf2.sh restart
- This usually means you pressed