Skip to content

netwarlan/tf2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Team Fortress 2

Docker Build License

The following repository contains the source files for building a Team Fortress 2 server.

Running

To run the container, issue the following example command:

docker run -d \
-p 27015:27015/udp \
-p 27015:27015/tcp \
-e TF2_SERVER_HOSTNAME="DOCKER TF2" \
-e TF2_SERVER_MAXPLAYERS="32" \
ghcr.io/netwarlan/tf2

Environment Variables

We can make dynamic changes to our TF2 containers by adjusting some of the environment variables passed to our image. Below are the ones currently supported and their (defaults):

Environment Variable Default Value
TF2_SERVER_PORT 27015
TF2_SERVER_MAXPLAYERS 24
TF2_SERVER_MAP ctf_2fort
TF2_SERVER_HOSTNAME TF2 Server
TF2_SVLAN 0
TF2_SERVER_PW No password set
TF2_SERVER_RCONPW No password set
TF2_SERVER_UPDATE_ON_START true
TF2_SERVER_VALIDATE_ON_START false
TF2_SERVER_REMOTE_CFG No url set
TF2_SERVER_ENABLE_PROPHUNT false
TF2_SERVER_CONFIG server.cfg

Health Check

The container includes a built-in health check that monitors the srcds process. Docker will automatically report the container as unhealthy if the game server stops running.

Prop Hunt Setup

A prop hunt server can be stood up by passing the following environment variable TF2_SERVER_ENABLE_PROPHUNT=true when starting up the container. This will install MetaMod and SourceMod into the container as well as all the necessary assets like maps, sounds, sourcemod plugins, etc...

Note: It does appear the TF2 server crashes when attempting to connect to the server for the first time after standing up this type of server. Appears to be a bug, but simply connecting again appears to work fine. No further testing has been done.

Troubleshooting

Server won't start

  • Check Docker logs: docker logs <container_id>
  • Verify all required ports are available and not in use
  • Ensure adequate disk space for game files

Slow startup

  • First startup downloads ~8GB of game files
  • Subsequent startups are faster if game files are persisted via volume

Players can't connect

  • Verify ports 27015 UDP/TCP are forwarded/exposed correctly
  • Check TF2_SVLAN is set to 0 for internet play
  • Ensure firewall rules allow incoming connections

License

This project is open source. See the repository for license details.

About

TF2 Server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages