Far Cry Docker Container
This Docker container runs a Far Cry dedicated server. It is built on the WINE image and runs the game's dedicated server, Bin32/FarCry_WinSV.exe from patch 1.4, on a virtual display. The container doesn't download the game, so you provide the files.
Quick Start
services:
farcry:
image: lancommander/farcry:latest
container_name: farcry
ports:
- 49001:49001/udp
- 49124:49124/udp
- 5678:5678/udp
volumes:
- "/data/Servers/Far Cry/Deathmatch:/config"
environment:
FC_SERVER_NAME: "My Far Cry Server"
user: root
cap_add:
- SYS_ADMIN
security_opt:
- apparmor:unconfined
restart: unless-stopped
Before the first start, copy a Far Cry 1.4 install, the folder that contains Bin32/, into Server/. You can instead set FC_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.PostInitialization/20-InstallFarCry.ps1checks forServer/Bin32/FarCry_WinSV.exe. If it's missing andFC_ARCHIVE_URLis set, the hook downloads and extracts the archive and remounts the overlay.PostInitialization/30-ConfigureFarCry.ps1writes the non-emptyFC_*settings intoProfiles/server/<FC_PROFILE>_server.cfg, andFC_MAPCYCLEintoProfiles/server/<FC_PROFILE>_mapcycle.txt.START_EXE(/usr/local/bin/farcry-server) runsBin32/FarCry_WinSV.exe "sv_port 49001" "log_verbosity 3" [START_ARGS] "SProfile_run LANCommander"from the game folder under Wine and Xvfb, and streamslog_WinSV.txttodocker logs.
Each FarCry_WinSV.exe argument is a console command. SProfile_run runs the profile and loads gr_NextMap. A server that is up ends its log with:
Level mp_monkeybay loaded in 1.541 seconds
Precaching level ...
--------------------------------------------------------------------------------
To run a dedicated server you should save a server-profile in the game.
The last lines are the server's standard help text and are printed even when the profile has loaded. To check that the server is up, send an All-Seeing Eye query to the game port + 123:
python3 -c 'import socket; s=socket.socket(2,2); s.settimeout(3); s.sendto(b"s",("<server>",49124)); print(s.recvfrom(4096)[0])'
# b'EYE1\x07farcry\x0649001\x0fFar Cry Server\x04FFA\rmp_monkeybay\x0b1.4.0.1405...'
Configuration Options
Ports
- 49001/udp: Game (
FC_PORT) - 49124/udp: All-Seeing Eye status queries. This is always the game port + 123
- 5678/udp: CryNetwork binds this fixed port whatever
FC_PORTis. Its purpose is unconfirmed; publish it to be safe
The game's own documentation also lists TCP 40000-42999 and UDP 41005, 41006 and 44000. Those are for Ubi.com and aren't used on a LAN.
Environment Variables
See the README for the full table.
Server Profile
A server profile is a Lua script of cvar = "value" lines in Profiles/server/<name>_server.cfg. It is the file the game's Multiplayer > Create Server menu writes with Save Profile. The hook edits the profile through the merged view, so the edited copy is in Overlay/ and is yours to change. A cvar that also has a non-empty FC_* variable is overwritten on every start. You can add any other server cvar to the file, e.g.:
gr_DamageScale = "1"
gr_PrewarOn = "0"
net_cheatprotection = "1"
To use a profile saved in the game instead, copy it to Overlay/Profiles/server/ and set FC_PROFILE to its name.
Map Rotation
The map cycle file has one map per line: <map> <game type> [time limit] [respawn time] [invulnerability timer] [max players] [min team size] [max team size]. The optional values override the profile's for that map. FC_MAPCYCLE takes the same entries separated by commas. The rotation can change the game type, but each map must support the type it's given:
| Game type | Maps |
|---|---|
FFA, TDM | mp_cliffside, mp_monkeybay, mp_monkeybay_n, mp_radio, mp_surf |
ASSAULT | mp_airstrip, mp_dam, mp_dune, mp_freighter, mp_jungle, mp_mangoriver, mp_px_airstrip, mp_px_dam, mp_px_dune, mp_px_freighter, mp_px_jungle, mp_px_mangoriver |
Set FC_MAPCYCLE to empty to use the stock Profiles/server/mapcycle.txt, which mixes all three game types.
Hooks
| Hook | When |
|---|---|
PreInstallFarCry / PostInstallFarCry | Around the game file check/download |
PreInitializeWinePrefix / PostInitializeWinePrefix | Around Wine prefix creation (WINE image) |
Put .ps1 scripts in config/Scripts/Hooks/<HookName>/.
Troubleshooting
- The container exits right away with no log: FarCry_WinSV is a GUI program and exits silently without a display. Keep
WINE_XVFB=true. - The log ends with
failed to load profile:Profiles/server/<FC_PROFILE>_server.cfgis missing or isn't valid Lua. DeleteOverlay/Profiles/server/<FC_PROFILE>_server.cfgto regenerate it from theFC_*settings. - The map doesn't load or the game type is wrong: the map doesn't support that game type. See the table above.
ERROR: failed to open bannedip.txt for reading!: harmless. It only means no IPs are banned.err:vulkan:vulkan_init_once Failed to load libvulkan.so.1: harmless; the server runs without Vulkan.- Not in the in-game LAN list: LAN discovery by broadcast needs the container on the LAN itself (macvlan/ipvlan, or
network_mode: host). Clients can always join by IP. - The log never shows the map loading:
FC_LOG_VERBOSITYis below 3. The server can still be running; check with the status query. - No console commands: the console only exists in the server's window. Change settings through the environment or the profile and restart, or set
FC_RCON_PASSWORDand use RCon from a game client (cl_rcon_serverip,cl_rcon_port,cl_rcon_password, thenrcon <command>).