Runs a Call of duty 4 Modern Warfare dedicated server in a Docker container.
Cod4x build
Docker build
Download size | Image size | RAM usage | CPU usage |
---|---|---|---|
105.4MB | 305MB | 300MB to 400MB | Low |
It is based on:
- Cod4x Linux Server
- Debian stretch slim
- g++-multilib
- COD4 Client game running on Windows
- COD4 running on version 1.7 have to update to 1.8
- Original COD4 main and zone files required
- Cod4x server features
- Works with custom mods and maps (see the Mods section)
- Easily configurable with docker-compose
- Run a lightweight Apache HTTP server for your clients to download your mods and usermaps
- Default cod4 configuration file server.cfg
- Placed into
/yourpath/main
- Launched by default when not using mods with
exec server.cfg
- Easily changeable
- Placed into
We assume your call of duty 4 game is installed at /mycod4path
- On your host, create the following directories:
/yourpath/main
/yourpath/zone
/yourpath/mods
/yourpath/usermaps
- From your Call of Duty 4 installation directory:
- Copy all the
.iwd
files from/mycod4path/main
to/yourpath/main
- Copy all the files from
/mycod4path/zone
to/yourpath/zone
- (Optional) Copy the mods you want to use from
/mycod4path/mods
to/yourpath/mods
- (Optional) Copy the maps you want to use from
/mycod4path/usermaps
to/yourpath/usermaps
- Copy all the
-
Download docker-compose.yml
-
Edit docker-compose.yml and replace:
/yourpath
with your actual host path- (Optional) the value of
ARGS
with the argument you want (i.e. to use mods) - (Optional) the port mappings of each of the 2 containers
-
To allow clients to download your mod and/or custom maps:
-
Locate the relevant configuration file - for example
main/server.cfg
ormods/mymod/server.cfg
-
Modify/Add the following lines & change
youraddress
to your IP or domain name:set sv_allowdownload "1" set sv_wwwDownload "1" set sv_wwwBaseURL "http://youraddress:8000" // supports http, https and ftp addresses set sv_wwwDlDisconnected "0"
-
You will have to setup port forwarding on your router. Ask me if you need help or Google.
-
-
Launch the two containers in the background with:
docker-compose up -d
In a terminal, enter (make sure to change paths):
docker run -d --name=cod4 --restart=always -p 28960:28960/udp \
-v /yourpath/main:/cod4/main -v /yourpath/zone:/cod4/zone \
-v /yourpath/mods:/cod4/mods -v /yourpath/usermaps:/cod4/usermaps \
-e 'ARGS=+map mp_shipment' qmcgaw/cod4
- The container UDP port 28960 is forwarded to the host UDP port 28960
- The environment variable ARGS is optional and defaults to
+set dedicated 2+set sv_cheats "1"+set sv_maxclients "64"+exec server.cfg+map_rotate
To allow clients to download your mod and/or custom maps
-
Launch a lightweight HTTP server container with:
docker run -d --name=cod4-http -p 8000:80/tcp --restart=always \ -v /yourpath/mods:/usr/local/apache2/htdocs/mods \ -v /yourpath/usermaps:/usr/local/apache2/htdocs/usermaps httpd:alpine
Note that you can change the
8000
port to any port you like. -
Locate the relevant configuration file - for example
main/server.cfg
ormods/mymod/server.cfg
-
Modify/Add the following lines & change
youraddress
to your IP or domain name:set sv_allowdownload "1" set sv_wwwDownload "1" set sv_wwwBaseURL "http://youraddress:8000" // supports http, https and ftp addresses set sv_wwwDlDisconnected "0"
-
You will have to setup port forwarding on your router. Ask me if you need help or Google.
- Make sure you updated your game to version 1.7 first (see this)
- Download the COD4x client ZIP file
- Using Winrar / 7Zip / Winzip, extract the cod4x_client.zip to your COD4 game directory
- Double click on install.cmd that you just extracted
- When launching the multiplayer game, you should see at the bottom right:
- Make sure you updated your COD4 Game to 1.8
- Launch the COD4 multiplayer game (iw3mp.exe)
- Click on Join Game
- Click on Source at the top until it's set on Favourites
- Click on New Favourite on the top right
- Enter your host LAN IP Address (i.e.
192.168.1.26
)- Add the port if you run it on something else than port UDP 28960 (i.e.
192.168.1.26:28961
)
- Add the port if you run it on something else than port UDP 28960 (i.e.
- Click on Refresh and try to connect to the server in the list
Assuming:
- Your mod directory is
mymod
in/yourpath/mods/
- Your main mod configuration file is
server.cfg
in/yourpath/mods/mymod/
Set the environment variable ARGS
to:
+set dedicated 2+set sv_cheats "1"+set sv_maxclients "64"+set fs_game mods/mymod+exec server.cfg +map_rotate
The following parameters are write protected and can't be placed in the server configuration
file, and must be in the ARGS
environment variable:
+set dedicated 2
- 2: open to internet, 1: LAN, 0: localhost+set sv_cheats "1"
- 1 to allow cheats, 0 otherwise+set sv_maxclients "64"
- number of maximum clients+exec server.cfg
if using a configuration file+set fs_game mods/mymod
if using a custom mod+set com_hunkMegs "512"
don't use if not needed+set net_ip 127.0.0.1
don't use if not needed+set net_port 28961
don't use if not needed+map_rotate
OR i.e.+map mp_shipment
should be the last launch argument
- Easily switch between mods: script file or management tool
- Leetmode
- Plugins (see https://hub.docker.com/r/callofduty4x/cod4x18-server/)
- Run as non root (problems with mounted permissions)
- Run on Alpine (half the image size)
- Credits to the developers of Cod4x server
- The help I had on Cod4x.me forums