Postal 2 Docker Container
This Docker container runs a Postal 2: Share the Pain dedicated server. It is built on the WINE image and runs the retail game's Unreal Engine 2 server, UCC.exe server. The container doesn't download the game, so you provide the files.
Quick Start
services:
postal2:
image: lancommander/postal2:latest
container_name: postal2
ports:
- 7777:7777/udp
- 7778:7778/udp
- 8777:8777/udp
volumes:
- "/data/Servers/Postal 2/Deathmatch:/config"
environment:
P2_SERVER_NAME: "My Postal 2 Server"
P2_MAP: "MPDGT-Asylum"
P2_GAME_TYPE: "MultiGame.xDeathMatch"
P2_ADMIN_PASSWORD: "changeme"
user: root
cap_add:
- SYS_ADMIN
security_opt:
- apparmor:unconfined
restart: unless-stopped
Copy a Share the Pain 1409 install (the folder with System/Postal2MP.exe, System/UCC.exe and Maps/; ShareThePain/ in a full Postal 2 install) into Server/ before the first start. You can instead set P2_ARCHIVE_URL to a zip of that folder or of a full Postal 2 install.
How It Starts
PostInitialization/10-InitializeWinePrefix.ps1(from the WINE image) creates the Wine prefix in/config/wineprefix.PostInitialization/20-InstallPostal2.ps1checks forServer/System/UCC.exe. If it's missing andP2_ARCHIVE_URLis set, the hook downloads the archive, extracts the folder that holdsSystem/Postal2MP.exe, and remounts the overlay.PostInitialization/30-ConfigurePostal2.ps1copiesSystem/Default.initoSystem/Server.ini(P2_INI) if it doesn't exist yet. It does this throughMerged/, so the file lands inOverlay/System/. It then writes the non-emptyP2_*settings into it, sets the map rotation, drops maps that aren't inMaps/from every rotation, and removes the master server uplink.START_EXE(/usr/local/bin/p2-server) runsUCC.exe server <P2_MAP>?Game=<P2_GAME_TYPE>[?AdminPassword=...] ini=Server.ini log=server.logfromSystem/under Wine.
A successful start ends with:
Game class is 'xDeathMatch'
TcpNetDriver on port 7777
...
UdpServerQuery(crt): Port 7778 successfully bound.
...
Game engine initialized
Configuration Options
Ports
- 7777/udp: Game (
P2_PORT) - 7778/udp: Server query, GameSpy protocol (game port + 1).
\status\returns the name, map, game type, version (gamever 1409) and rules. - 8777/udp: LAN beacon. The in-game LAN browser broadcasts
REPORTQUERYhere, and the server repliespostal2 7778.
Environment Variables
See the README for the full table.
Server ini
Overlay/System/Server.ini is yours to edit. Only the keys that have a non-empty P2_* variable are rewritten on start. Delete the file to regenerate it from Default.ini.
- Mode rules are per game type, e.g.
[MultiGame.xDeathMatch] GoalScore/TimeLimitor[MultiGame.xCTFGame] FriendlyFireScale.P2_GOAL_SCOREandP2_TIME_LIMITgo into the section of the currentP2_GAME_TYPE. - Bots:
[MultiBase.MPGameInfo] MinPlayers(bots fill up to this many players),bAutoFillBots,BotDifficulty. - Map rotations:
Maps[0]..Maps[31]in[MultiGame.DMMapList],TDMMapList,CTFMapListandGBMapList.P2_MAPSreplaces the list of the current game type. - Web admin:
[UWeb.WebServer] bEnabled=True(andListenPort) turns on the UTServerAdmin web interface. It is off by default; expose its TCP port if you enable it.
UCC saves its config to the server ini on exit, so values can also change there after an admin command.
Hooks
| Hook | When |
|---|---|
PreInstallPostal2 / PostInstallPostal2 | Around the game file check/download |
PreInitializeWinePrefix / PostInitializeWinePrefix | Around Wine prefix creation (WINE image) |
Put .ps1 scripts in config/Scripts/Hooks/<HookName>/.
Troubleshooting
- Server not in the LAN browser: the browser finds servers by UDP broadcast to 8777, so the container needs its own LAN address (macvlan/ipvlan) or host networking. Joining by IP works through port mapping.
- Clients can't join / version mismatch: the server reports
gamever 1409andminnetver 1407. Clients need Share the Pain 1409 with the same packages. - Admin password in the logs: the engine only reads the admin password from the map URL, so it appears in the
Browse:/LoadMap:/InitGame:lines ofdocker logsandserver.log. - Settings ignored: they go into
P2_INI, notPostal2MP.iniorDefault.ini. CheckOverlay/System/Server.ini. P2_MASTER_SERVER_UPLINK=truehas no effect on an existing ini: the uplink server actor was removed from it on an earlier start. AddServerActors=IpDrv.UdpServerUplink MasterServerAddress=... MasterServerPort=...back under[Engine.GameEngine], or delete the ini.System/UCC.exe not found:Server/must contain the Share the Pain folder itself (Server/System/UCC.exe), not a folder that contains it.