If you want to build an image yourself, follow the steps below. This can be useful in cases where you want to make changes to the build scripts or add custom functionality. It is also useful for testing changes before submitting a contribution to the project.
- Clone this project locally.
- Define the game you want the server to run. You can do this by setting an environment variable on your command line.
export GAME=cstrikeBefore continuing to the following steps, verify that the environment variable is set by running echo $GAME in your terminal. It should send back the variable you just set.
Tip
Available options include the following, these names are recognized by the app_set_config 90 mod command in hlds.txt.
valve(Half-Life Deathmatch)cstrike(Counter-Strike)czero(Counter-Strike Condition Zero)dmc(Deathmatch Classic)gearbox(Half-Life Opposing Force)ricohet(Ricochet)dod(Day of Defeat)tfc(Team Fortress Classic)
To install a specific sub version, such as a beta, you can utilize the FLAG environment variable to pass arbitrary command flags to SteamCMD. For example, export FLAG=-beta steam_legacy can be used to get a Pre-25th Anniversary build of some titles.
- Navigate to the
containerfolder (where this README file is) and build the image.
docker compose build- If you want to modify the server startup arguments, you can provide a
commandproperty withindocker-compose.yml; for a list of available arguments, visit the Valve Developer Wiki.
Note
In most cases, you'll need to specify +map for the server to be joinable.
services:
hlds:
command: +maxplayers 16 +map cs_italy- Start the image. Once the Half-Life Dedicated Server client starts, you'll receive a stream of messages, including the server's public IP address and any startup errors.
docker compose up- Connect to your server via the public IP address by loading the game on Steam. To play, you must own a copy of the game on Steam.
- Optional: If you want to start a custom mod, you can modify your
$GAMEenvironment variable once the image is built before runningdocker compose up. This allows you to add custom scripts to the server image while telling the dedicated server client what mod to use. If you're building a custom image with the intent on playing a custom mod it's recommended that you set the$GAMEvariable tovalvefor the initial build.
$ export GAME=valve
$ docker compose build
$ export GAME=decay
$ docker compose up