Call of Duty 4: Modern Warfare dedicated server. Uses CoD4x server mod. Based off hberntsen/docker-cod4 with a number of enhancements.
- Clone this repository.
- Build the docker image, e.g.
docker build -t matracey/modern-warfare - Copy the resource files from the
main/andzone/directories to a directory of your choice on your Docker host.- You can omit the
main/videodirectory as this is not needed by the server. - I use
/var/cod4/res, and within there I havemain,zone,usermapsandmods.
- You can omit the
- Run your server!
- I use this command to start my server:
docker run --user=root -it --name mw \ -p 28960:28960 -p 28960:28960/udp \ -v /var/cod4/res/main:/home/cod4/main \ -v /var/cod4/res/zone:/home/cod4/zone \ -v /var/cod4/res/mods:/home/cod4/mods \ -v /var/cod4/res/usermaps:/home/cod4/usermaps \ -v /var/cod4/server.cfg:/home/cod4/main/server.cfg \ -v /var/cod4/games_mp.log:/home/cod4/main/games_mp.log \ matracey/world-at-war +set sv_authorizemode '-1' +exec server.cfg +map_rotate - Connect to your server!
-
-it: This runs the docker container in interactive, pseudo-tty mode. You'll need this to be able to type into the CoD console.- You could also use
-dithere instead, which would start the container detached. You can attach later by runningdocker attach <container>. - To restart a stopped container, use the command
docker start -ai <container>. This will automatically and interactively attach to the container on start.
- You could also use
-
-p 28960:28960 -p 28960:28960/udp: This forwards TCP & UDP ports 28960 (the default CoD Server Port) to the docker host. I haven't needed any other ports exposed but YMMV. -
-v /var/cod4/res/main:/home/cod4/main: Mounts themainfolder in my Docker host's filesystem to themainfolder within the container's filesystem. I copied the contents of this from the CoD4:MW installation on my PC. -
-v /var/cod4/res/main:/home/cod4/zone: Mounts thezonefolder in my Docker host's filesystem to thezonefolder within the container's filesystem. I copied the contents of this from the CoD4:MW installation on my PC. -
-v /var/cod4/res/mods:/home/cod4/mods: Mounts themodsfolder in my Docker host's filesystem to themodsfolder within the container's filesystem. I keep any mods I want to install on the server in here. -
-v /var/cod4/res/usermaps:/home/cod4/usermaps: Mounts theusermapsfolder in my Docker host's filesystem to theusermapsfolder within the container's filesystem. I keep my custom maps in here. -
-v /var/cod4/server.cfg:/home/cod4/main/server.cfg: Mounts theserver.cfgfile within themainfolder within the container's filesystem.- NB: This file needs to exist on your host machine before you run the server or Docker will create this as a directory.
-
-v /var/cod4/games_mp.log:/home/cod4/main/games_mp.log: Mounts thegames_mp.logfile within themainfolder within the container's filesystem. Log file for the server.- NB: This file needs to exist on your host machine before you run the server or Docker will create this as a directory.
-
matracey/world-at-war +set sv_authorizemode '-1' +exec server.cfg +map_rotate: You can pass custom arguments to the server here. These are the args that are passed by default.
I've also included a sample server.cfg file in this repository. It's not part of the build, but it should help you to build out your own config.