Quake II Docker Container
This Docker container runs a Quake II dedicated server. It is built on the base image and runs Q2PRO's dedicated server, q2proded. The image compiles q2proded, Q2PRO's baseq2 game library and the Threewave CTF game library from pinned source commits at build time (Q2PRO_REF and CTF_REF change them). You supply the game data.
Quick Start
services:
quake2:
image: lancommander/quake2:latest
container_name: quake2
ports:
- 27910:27910/udp
volumes:
- "/data/Servers/Quake II/Deathmatch:/config"
environment:
QUAKE2_SERVER_NAME: "My Quake II Server"
QUAKE2_MAP: "q2dm1"
QUAKE2_RCON_PASSWORD: "changeme"
user: root
cap_add:
- SYS_ADMIN
security_opt:
- apparmor:unconfined
restart: unless-stopped
Before the first start, copy the baseq2/ folder (pak0.pak, pak1.pak, pak2.pak) into Server/, and ctf/ or any mod folders next to it.
How It Starts
-
PostInitialization/30-ConfigureQuake2.ps1checks forbaseq2/pak0.pakand writes the non-emptyQUAKE2_*settings into<QUAKE2_GAME or baseq2>/lancommander.cfgassetcommands. WhenQUAKE2_MAPis set, that file starts withexec server.cfg, so your ownserver.cfgruns first and theQUAKE2_*settings override it. Anymapcommand inserver.cfgis then commented out (the stockctf/server.cfgends withmap q2ctf1), because it would start the server before the other settings apply and Q2PRO would ignore the launcher's+map. WhenQUAKE2_MAPis empty,exec server.cfgcomes last instead, soserver.cfgcan override everything and has to start a map itself. The hook writes throughMerged/, so its files land inOverlay/. -
START_EXE(/usr/local/bin/quake2-server) runs fromMerged/:/opt/q2pro/q2proded +set basedir /config/Merged +set libdir /opt/q2pro +set homedir ""
+set sys_forcegamelib <mod library or empty> +set net_port 27910 +set maxclients 16
+set game <QUAKE2_GAME> +exec lancommander.cfg <START_ARGS> +map q2dm1basedirisMerged/andhomediris empty, so logs, demos and anything else the server writes land inOverlay/. The game library is loaded from/opt/q2pro/<game>/gamex86_64.so, falling back to/opt/q2pro/baseq2/. IfMerged/<QUAKE2_GAME>/gamex86_64.soexists, it is loaded instead (sys_forcegamelib).
Configuration Options
Ports
- 27910/udp: game, server info queries and LAN browser (
QUAKE2_PORT). - 27910/tcp: MVD/GTV spectator relay connections, only used when you turn on MVD in
server.cfg(sv_mvd_enable). - 80/tcp: HTTP downloads (optional,
HTTP_FILESERVER_ENABLED).
Environment Variables
See the README for the full table.
server.cfg
Overlay/<QUAKE2_GAME or baseq2>/server.cfg is yours to create and edit. Any console command works there, for example set sv_fps 20 (Q2PRO's higher tick rate, for clients that support it), set sv_iplimit 0 (allow many clients from one address), set public 0 or set logfile 2. Use set for game settings (fraglimit, dmflags, sv_maplist, ...), because the game doesn't create those until the first map loads. QUAKE2_* variables that are set override the same settings in it; clear a variable (set it to "") to control that setting from server.cfg instead.
Game modes
| Mode | Settings |
|---|---|
| Deathmatch | QUAKE2_DEATHMATCH=1, a q2dm1 to q2dm8 map |
| Capture the Flag | QUAKE2_GAME=ctf, QUAKE2_MAP=q2ctf1 (to q2ctf5), QUAKE2_CAPTURE_LIMIT=8, QUAKE2_DMFLAGS=280084. Needs ctf/pak0.pak |
| Co-op | QUAKE2_COOP=1 (sets deathmatch 0), QUAKE2_MAP=base1, QUAKE2_SKILL for difficulty, QUAKE2_FRAG_LIMIT=0, QUAKE2_TIME_LIMIT=0 |
Maps
When the frag, time or capture limit is reached, the server moves to the next map in QUAKE2_MAP_LIST (sv_maplist), wrapping around at the end; this works in both the baseq2 and CTF games. A map that isn't in the list, or no list at all, goes to the map's own exit (target_changelevel), or replays the same map when it has none. QUAKE2_DMFLAGS with 32 (same level) always replays the map. Admins can change the map in game with rcon gamemap <map>, and in CTF also with the admin menu and warp command.
Remote console
With QUAKE2_RCON_PASSWORD set, run console commands from a client with rcon_password <password> and rcon <command> (for example rcon gamemap q2dm3 or rcon status).
HTTP downloads
Q2PRO and R1Q2 clients can download missing maps and models over HTTP instead of the slow in-game download. Set HTTP_FILESERVER_ENABLED=true and QUAKE2_DOWNLOAD_URL=http://<server address>/. The file server serves Merged/, so a client asking for <game>/maps/x.bsp gets Merged/<game>/maps/x.bsp. HTTP_FILESERVER_FILE_PATTERN limits it to content folders, so paks, configs and logs aren't served. Only loose files can be downloaded: a map inside a .pak must be extracted to <game>/maps/ to be served.
Hooks
Put .ps1 scripts in config/Scripts/Hooks/<HookName>/ to run at the base image's lifecycle hooks (PreInitialization, PostInitialization, ServerStarted, ServerStopped).
Troubleshooting
baseq2/pak0.pak not found: the game data isn't inServer/, or the folder or file names have capitals. Copybaseq2/from a Quake II install and use lowercase names.- The server starts on a different map than
QUAKE2_MAP, with "Using 'map' will cause full server restart": a config ran amapcommand before the launcher's+map. The hook comments outmaplines in<game>/server.cfg; look for one in another config thatserver.cfgexecs. Couldn't exec server.cfgin the log is harmless: there's noserver.cfgfor the game yet.- A mod runs the deathmatch game instead of its own: the mod has only a Windows
gamex86.dll. Put a Linuxgamex86_64.sobuilt for it inOverlay/<mod>/. - Settings in
server.cfglikefraglimit 30do nothing, or print "Unknown command": useset fraglimit 30. The game's cvars don't exist yet whenserver.cfgruns. - Server not in the LAN browser: the browser finds servers by UDP broadcast to port 27910, so the container needs its own LAN address (macvlan/ipvlan) or host networking, and
QUAKE2_PORTmust stay27910. With port mapping, clients join by IP (connect <ip>:27910in the console). - Everyone behind one address can't join: Q2PRO limits connections per IP (
sv_iplimit, default 3). Addset sv_iplimit 0toserver.cfgfor LAN parties behind NAT.