qmcgaw/cod4
Runs a Call of duty 4 Modern Warfare dedicated server in a Docker container
10K+
Call of duty 4 dedicated server in a 125MB Docker image.
exec server.cfg
We assume your call of duty 4 game is installed at /mycod4path
On your host, create the directories ./main
, ./zone
, ./mods
and ./usermaps
.
From your Call of Duty 4 installation directory:
.iwd
files from /mycod4path/main
to ./main
/mycod4path/zone
to ./zone
/mycod4path/mods
to ./mods
/mycod4path/usermaps
to ./usermaps
As the container runs as user ID 1000 by default, fix the ownership and permissions:
chown -R 1000 main mods usermaps zone
chmod -R 700 main mods usermaps zone
You can also run the container with --user="root"
(unadvised!) if this doesn't work, or build the image with --build-arg UID=yourid
.
Run the following command as root user on your host:
docker run -d --name=cod4 -p 28960:28960/tcp -p 28960:28960/udp -p 8000:8000/tcp \
-v /mycod4path/main:/home/user/cod4/main \
-v /mycod4path/zone:/home/user/cod4/zone \
-v /mycod4path/mods:/home/user/cod4/mods \
-v /mycod4path/usermaps:/home/user/cod4/usermaps:ro \
qmcgaw/cod4 +map mp_shipment
The command line argument +map mp_shipment
is optional and defaults to +set dedicated 2+set sv_cheats "1"+set sv_maxclients "64"+exec server.cfg+map_rotate
You can also download and modify the docker-compose.yml file and run
docker-compose up -d
By default, the container runs with an HTTP file server for mods and usermaps on port 8000
.
-e HTTP_SERVER=off
-p 9000:8000/tcp
-e ROOT_URL=/cod4
. This is useful if you use a reverse proxy.Locate the relevant cod4 configuration file - for example main/server.cfg
or mods/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"
Feel free to open an issue for help setting this up, such as port forwarding or reverse proxy setup help
20.1
192.168.1.26
)
192.168.1.26:28961
)Assuming:
./mymod
./mymod/server.cfg
Set the command line option 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 command passed to the container:
+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 argumentBy default, the Docker image uses this command.
docker pull qmcgaw/cod4