Creates a Half-Life Dedicated Server instance using Docker. You can run any games the Half-Life Dedicated Server client supports out of the box, including the ability to add custom configurations, mods and plugins.
Special thank you to all the past and present GitHub Sponsors 💖.
Before starting, ensure you have the Docker daemon and the Docker CLI tool installed and available.
Important
The following steps will not work if you use an ARM architecture system. For best results, use a system running x86-64.
If you're just looking to start a server as quickly as possible you can follow these steps to use a pre-built image on Docker Hub or the GitHub Container Registry.
- Create a
docker-compose.yml
file by copying and pasting the example below. Adjust theimage
property so the tag name corresponds with the game you want to use. Additionally you can adjust the server startup arguments by modifying thecommand
property; for a list of available arguments, visit the Valve Developer Wiki.
Note
In the majority of cases you'll need to specify +map
for the server to be joinable.
services:
hlds:
build: docker
# 📣 Adjust the image value here with the desired game you want the server to use.
image: jives/hlds:cstrike
volumes:
- "./config:/temp/config"
- "./mods:/temp/mods"
ports:
- "27015:27015/udp"
- "27015:27015"
- "26900:2690/udp"
environment:
- GAME=${GAME}
# 📣 Modify your server startup commands here.
# 📣 Remember: Stating map is based on the game, and will likely be different between images.
command: +maxplayers 12 +map cs_italy
Tip
Available images include:
jives/hlds:valve
(Half-Life Deathmatch)jives/hlds:cstrike
(Counter-Strike)jives/hlds:czero
(Counter-Strike Condition Zero)jives/hlds:dmc
(Deathmatch Classic)jives/hlds:gearbox
(Half-Life Opposing Force)jives/hlds:ricohet
(Ricochet)jives/hlds:dod
(Day of Defeat)jives/hlds:tfc
(Team Fortress Classic)
- 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 IP address by loading the game on Steam and start playing. You must own a copy of the game on Steam in order to play. ⌨️
If you want to build an image yourself, you can follow the steps below. This can be useful in cases where you want to make changes to the build scripts.
- Clone this project.
- Define the game you want the server to run. You can do this by setting an environment variable on your command line.
export GAME=cstrike
Before continuing to the next 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:
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)
- Build the image.
docker compose build
- If you want to modify the server startup arguments, you can provide a
command
property withindocker-compose.yml
; for a list of available arguments, visit the Valve Developer Wiki.
Note
In the majority of 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 IP address by loading the game on Steam and start playing. You must own a copy of the game on Steam in order to play. ⌨️
If you wish to add server configurations, such as add-ons, plugins, map rotations, etc, you can add them to the config
directory. Any configuration files will be copied into the container on start and placed within the folder for the specified game. For example, if you set the game as cstrike
, the contents of the config folder will be placed within the cstrike
directory on the server.
If you want to run a custom mod, you can do so with the mods
directory. Similar to the config
directory, this folder will be copied into your container on start alongside the other game folders.
- Add your mod files as a sub-directory of
mods
. For example if the mod name isdecay
, you'd place it inmods/decay
. - Define the
GAME
environment variable so it points to your mod name. This works if you're using a pre-built imagedocker-compose.yml
or by building one yourself.
export GAME=decay
- Build the image. If you don't want to build the image, I suggest using the pre-built
jives/hlds:valve
image.
docker compose build
- Start the image. Most Half-Life mods require specific startup arguments, refer to the Valve Developer Wiki and the instructions for the mod you're trying to run for more details. You can find details about how to add these above.
docker compose up
The Half-Life Dedicated Server client, Steam, SteamCMD and the titles themselves are property and ownership of Valve Software. All this software does is make it easier to interface with their provided tooling.