Freelancer Docker Container
This Docker container runs a Freelancer dedicated server. It is built on the WINE image and runs the retail EXE/FLServer.exe under Wine and Xvfb. The container doesn't download the game, so you provide the files.
Quick Start
services:
freelancer:
image: lancommander/freelancer:latest
container_name: freelancer
ports:
- 2302:2302/udp
- 6073:6073/udp
volumes:
- "/data/Servers/Freelancer/Default:/config"
environment:
FL_SERVER_NAME: "My Freelancer Server"
FL_MAX_PLAYERS: "16"
cap_add:
- SYS_ADMIN
security_opt:
- apparmor:unconfined
restart: unless-stopped
Copy a Freelancer 1.1 install (the folder with EXE/ and DATA/) into Server/ before the first start. You can instead set FL_ARCHIVE_URL to a zip of that folder.
How It Starts
PostInitialization/10-InitializeWinePrefix.ps1(from the WINE image) creates the Wine prefix in/config/wineprefix.PostInitializeWinePrefix/20-InstallWineRuntimes.ps1runswinetricks directplayandwinetricks mfc42once each, using redists cached in the image. Marker fileswineprefix/.lancommander-directplayand.lancommander-mfc42record that they're done. Delete one to reinstall it.PostInitialization/20-InstallFreelancer.ps1checks forServer/EXE/FLServer.exe. If it's missing andFL_ARCHIVE_URLis set, the hook downloads the archive.PostInitialization/30-ConfigureFreelancer.ps1accepts the EULA in the Wine registry and writesFLServer.cfgfrom theFL_*variables.START_EXE(/usr/local/bin/fl-server) runsFLServer.exe /c /p<FL_PORT>fromEXE/withwine-run.
FLServer writes no log and no console output, so docker logs ends at Starting: FLServer.exe /c /p2302. To check that it's up, send a DirectPlay enumeration query (UDP 00 02 12 34 02) to port 2302 or 6073. The reply contains the server name and description.
Configuration Options
Ports
- 2302/udp: Game (DirectPlay host,
FL_PORT) - 6073/udp: DirectPlay enumeration (
dpnsvr), which the in-game LAN search uses. It forwards queries to the game port.
DirectPlay also opens some dynamic UDP ports. Giving the container its own LAN address (macvlan/ipvlan) is the most reliable setup.
Environment Variables
See the README for the full table.
FLServer.cfg
FLServer has no command-line or text settings. On first run it shows a EULA and then a modal "Server Configuration" dialog. It saves the dialog to My Games\Freelancer\Accts\MultiPlayer\FLServer.cfg in the user's Documents folder. Once that file exists, /c starts hosting without asking.
The hook rewrites the file on every start, so changes made in FLServer's own dialog don't persist. The format is a 369-byte binary dump of the dialog:
| Offset | Type | Field |
|---|---|---|
0x000 | int32 | 3 (version) |
0x004 | UTF-16 [33] | Server name |
0x046 | UTF-16 [129] | Description |
0x148 | UTF-16 [17] | Password |
0x16A | byte | Allow new players |
0x16B | byte | Internet accessible |
0x16C | int32 | Max players |
0x170 | byte | Allow players to harm other players |
Player Data
Accounts (accounts.cfg) and multiplayer characters are stored in wineprefix/drive_c/users/lancommander/Documents/My Games/Freelancer/Accts/MultiPlayer/. Back up that folder to keep characters. Deleting the prefix resets them.
Hooks
| Hook | When |
|---|---|
PreInstallFreelancer / PostInstallFreelancer | Around the game file check/download |
PreInitializeWinePrefix / PostInitializeWinePrefix | Around Wine prefix creation (WINE image) |
Put .ps1 scripts in config/Scripts/Hooks/<HookName>/.
Troubleshooting
- Server exits right away with code 53:
MFC42.DLLis missing from the prefix. Deletewineprefix/.lancommander-mfc42and restart. - No reply on 2302, process still running: FLServer is waiting on a dialog. That happens when
FLServer.cfgis missing or the EULA wasn't accepted. Check the30-ConfigureFreelancer.ps1lines indocker logs. - Clients don't see the server in the LAN list: Port 6073/udp must be reachable from the clients' broadcast domain. Clients can also connect by IP.
- Long names are cut off: The name, description and password fields hold 32, 128 and 16 characters.