Sign inSign up

ggoulart/csgo

By ggoulart

•Updated almost 8 years ago

csgo server

Image
1

820

ggoulart/csgo repository overview

⁠CSGO

The Dockerfile will build an image for running a Counter-Strike: Global Offensive dedicated server in a container.

⁠Build image
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.

⁠Run a CSGO dedicated server
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.

⁠Environment variable overrides

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.

⁠Adding files, plugins, etc.

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).

⁠Google Compute Engine Metadata

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 in server

connect 10.73.21.144; password password
rcon_password "yourRconPassword";

⁠Simple Commands

bot_add
maxplayers

⁠Game modes in the server

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

Modegame_typegame_mode
Classic Casual00
Classic Competitive01
Arms Race10
Demolition11
Deathmatch12

rcon game_mode 1;
rcon game_type 0;
rcon exec gamemode_competitive;
rcon mp_restartgame 1;

Tag summary

Content type

Image

Digest

Size

9.6 GB

Last updated

almost 8 years ago

docker pull ggoulart/csgo