Docker-Strike is a dockerized Half-Life Dedicated Server and can host any Half-Life Mod.
This project was initially written to host Counter-Strike servers using Docker hence the name "Docker-Strike".
You MUST have Git, Docker and Docker Compose installed.
Clone the repository using git:
git clone https://github.com/mertimran/docker-strikeCopy the example environment file and edit if needed:
cp .env.example .envBuild the images:
docker-compose build steamcmd ; \
docker-compose build hldsStart the container (-d is for daemonization):
docker-compose up -dGAME can be one of the following:
Note: Some gamemodes require you to have the game itself in your Steam library (e.g. Blue Shift).
| Name | Code |
|---|---|
| Half-Life Deathmatch | valve |
| Counter-Strike | cstrike |
| Counter-Strike: Condition Zero | czero |
| Deathmatch Classic | dmc |
| Day of Defeat | dod |
| Team Fortress Classic | tfc |
| Ricochet | ricochet |
| Half-Life: Blue Shift | bshift |
| Half-Life: Opposing Force | gearbox |
| Earth's Special Forces | esf |
| Natural Selection | ns |
GAME=cstrike
Hostname:
SERVER_NAME=Docker-Strike
IP address of the server (0.0.0.0 to allow connections from anywhere):
IP_ADDRESS=0.0.0.0
Port of the server, container automatically will allows connections from and to this port:
PORT=27015
Maximum player count:
MAX_PLAYERS=24
Map to load when starting the server:
MAP=de_dust2
Config file in case it is not named server.cfg:
CONFIG_FILE=server.cfg
Also, if you want to supply the environment variable directly to the container, you may do it like this:
docker run -d -p 27020:27015/udp -e GAME=cstrike -e GAME_APPID=90 -e IP_ADDRESS=0.0.0.0 -e PORT=27015 -e MAX_PLAYERS=24 -e MAP=de_dust2 -e SERVER_NAME="Docker-Strike" -e CONFIG_FILE=server.cfg docker-strike/hldsBut it will get messy really quickly, so it's better to use docker-compose.yaml.
To be versatile and to allow users to configure their Half-Life mods such as Counter-Strike installations as they like , this project copies the whole game directory (e.g. cstrike/) and allows editing of environment variables via .env file.
This means if you have an already existing Counter-Strike server installation, you can dockerize it by copying your existing cstrike/ directory to data/ directory. Easy right?
If you encounter permission-related errors when running the container, you might resolve them by adjusting the ownership and permissions of your game directory on the host machine.
Change ownership of the game directory:
chown -R $(id -u):$(id -g) ./data/cstrike/Update file permissions:
chmod -R 755 ./data/cstrike/Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Written by @mertimran