The Dockerfile will build an image for running a Counter-Strike: Global Offensive dedicated server in a container.
docker build -t csgo-server .
OR
make
The game is ~16GB, so the initial build will take a bit to download, depending on your download speed. Subsequent builds on the same machine should take only a few seconds, assuming the initial build image is cached by docker.
docker run \
-d \
-p 27015:27015/tcp \
-p 27015:27015/udp \
-p 27020:27020/udp \
-p 27020:27020/tcp \
-e "SERVER_HOSTNAME=hostname" \
-e "SERVER_PASSWORD=password" \
-e "RCON_PASSWORD=rconpassword" \
-e "STEAM_ACCOUNT=gamelogintoken" \
csgo-server
OR
make run
Valve requires a "Game Login Token" to run public servers. Confusingly, this token is also referred to as a steam account (it gets set on the server using sv_setsteamaccount). To get one, visit http://steamcommunity.com/dev/managegameservers. You'll need one for each server.
Below are the default values for environment variables that control the server configuration. Pass one or more of these to docker using the -e argument (example above) to override.
SERVER_HOSTNAME=An Amazing CSGO Server
SERVER_PASSWORD=changeme
RCON_PASSWORD=changeme
STEAM_ACCOUNT=changeme
CSGO_DIR=/csgo
IP=0.0.0.0
PORT=27015
TICKRATE=128
GAME_TYPE=0
GAME_MODE=1
MAP=de_dust2
MAPGROUP=mg_active
MAXPLAYERS=12
See containerfs/csgo/start.sh to understand more. The command-line arguments are at the bottom of the file.
The directory containerfs (container filesystem) is the equivalent of the root path (/). Any files or plugins you want to add, simply put them in the correct paths under containerfs, and they will appear in the same location in the container (except containerfs will be replaced with /).
For example, by default, CSGO is installed in the root path /csgo within the docker image. I want my matchmaking.cfg file to live in the cfg directory, so I put that file in containerfs/csgo/cfg/ and it appears in the right place inside the docker image (/csgo/cfg/matchmaking.cfg).
Passing GOOGLE_METADATA=1 fetches default values for environment variables from Google Compute Engine's Project or Instance Metadata. Right now it defaults to project level, but you can simply override METADATA_URL to point to instance data.
See https://cloud.google.com/compute/docs/storing-retrieving-metadata#querying.
connect 10.73.21.144; password password
rcon_password "yourRconPassword";
bot_add
maxplayers
gamemode_armsrace.cfg
gamemode_casual.cfg
gamemode_competitive.cfg
gamemode_competitive2v2.cfg
gamemode_cooperative.cfg
gamemode_coopmission.cfg
gamemode_custom.cfg
gamemode_deathmatch.cfg
gamemode_demolition.cfg
gamemode_teamdeathmatch.cfg
gamemode_training.cfg
| Mode | game_type | game_mode |
|---|---|---|
| Classic Casual | 0 | 0 |
| Classic Competitive | 0 | 1 |
| Arms Race | 1 | 0 |
| Demolition | 1 | 1 |
| Deathmatch | 1 | 2 |
rcon game_mode 1;
rcon game_type 0;
rcon exec gamemode_competitive;
rcon mp_restartgame 1;
Content type
Image
Digest
Size
9.6 GB
Last updated
almost 8 years ago
docker pull ggoulart/csgo