4.8 KiB
docker-garrysmod
A Docker image for running a Garry's Mod dedicated server, based on hackebein/docker-srcds.
This repository is a fork of Hackebein/docker-garrysmod.
Garry's Mod is a physics sandbox. There aren't any predefined aims or goals. The game gives you the tools and leaves you to play.
The image is automatically built and pushed to:
git.sh-edraft.de/sh-edraft.de/garrysmod
Table of Contents
- Quick Start
- Enabling the Steam API
- Public Listing
- Workshop Collections
- Custom Server Configuration
- Example: Trouble in Terrorist Town (TTT)
- Environment Variables
- Overlay Folder
- Further Configuration
Quick Start
Start a basic sandbox server on the default port (27015):
docker run -it \
-p 27015:27015/tcp \
-p 27015:27015/udp \
git.sh-edraft.de/sh-edraft.de/garrysmod
Enabling the Steam API
Some features (public server listing, Workshop downloads) require a Steam Web API key.
docker run -it \
-p 27015:27015/tcp \
-p 27015:27015/udp \
-e "AUTHKEY=..." \
git.sh-edraft.de/sh-edraft.de/garrysmod
Get your AUTHKEY from http://steamcommunity.com/dev/apikey.
Public Listing
If you've set AUTHKEY, your server is automatically listed publicly. Alternatively, you can register a Game Server Login Token (GLST) manually:
docker run -it \
-p 27015:27015/tcp \
-p 27015:27015/udp \
-e "GLST=..." \
git.sh-edraft.de/sh-edraft.de/garrysmod
Get your GLST from http://steamcommunity.com/dev/managegameservers (App ID: 4000).
Workshop Collections
Downloading Workshop content requires AUTHKEY to be set.
docker run -it \
-p 27015:27015/tcp \
-p 27015:27015/udp \
-e "AUTHKEY=..." \
-e "WORKSHOPCOLLECTIONID=..." \
git.sh-edraft.de/sh-edraft.de/garrysmod
Custom Server Configuration
Mount your own server.cfg into the container:
docker run -it \
-p 27015:27015/tcp \
-p 27015:27015/udp \
-v ./server.cfg:/opt/steam/garrysmod/cfg/server.cfg \
git.sh-edraft.de/sh-edraft.de/garrysmod
Example: Trouble in Terrorist Town (TTT)
# make sure the server.cfg file exists
touch ./server.cfg
# start the container
docker run -it \
-p 27015:27015/tcp \
-p 27015:27015/udp \
-e "AUTHKEY=..." \
-e "GAMEMODE=terrortown" \
-e "MAP=ttt_minecraft_b5" \
-e "WORKSHOP=843519054" \
-e "WORKSHOPDL=843519054" \
-v ./server.cfg:/opt/steam/garrysmod/cfg/server.cfg \
-v ./overlay:/opt/overlay \
git.sh-edraft.de/sh-edraft.de/garrysmod
This uses the TTT Workshop Collection, downloaded both server-side (WORKSHOP) and client-side (WORKSHOPDL).
Environment Variables
| Variable | Description | Default |
|---|---|---|
AUTHKEY |
Steam Web API key. Required for the public server list and Workshop downloads. Get one at http://steamcommunity.com/dev/apikey | (empty) |
GLST |
Game Server Login Token for public listing. Get one at http://steamcommunity.com/dev/managegameservers (App ID 4000). Not needed if AUTHKEY is set |
(empty) |
GAME |
Game mod directory | garrysmod |
GAMEMODE |
Gamemode to run on server start | sandbox |
MAP |
Map to load on server start | gm_flatgrass |
MAPGROUP |
Map group / map cycle group | mg_active |
GAMETYPE |
Game type passed to the server | 0 |
MAXPLAYERS |
Maximum number of players | 16 |
TICKRATE |
Server tickrate. Note: changing this is not recommended | 66 |
CONFIG |
Server config file, relative to cfg/. Note: changing this is not recommended |
server.cfg |
WORKSHOP |
Workshop collection ID to download for the server | (empty) |
WORKSHOPDL |
Workshop collection ID for clients to download before joining | (empty) |
CUSTOMPARAMETERS |
Additional raw command-line parameters appended to the server start command | (empty) |
Overlay Folder
You can use an overlay folder to add or overwrite files provided by Steam (e.g. addons, configs, maps) without rebuilding the image:
-v ./overlay:/opt/overlay
See hackebein/docker-srcds: Overlay folder for details.
Further Configuration
This image inherits all environment variables and options from the parent image. See hackebein/docker-srcds for the full list of available configuration options.