Sign inSign up

henkallsn/docker-cod4

By henkallsn

Updated about 5 years ago

Docker to run Call of Duty 4 Dedicated Server (Using the COD4x server) Credit to matracey

Image
0

10K+

henkallsn/docker-cod4 repository overview

COD4 Docker dedicated server

Runs a Call of duty 4 Modern Warfare dedicated server in a Docker container.

Update: New feature. The docker can now get the gamefiles for you.

The webgui tag is WIP

Donate

  • Based on:
    • Cod4x server program
    • Unzip and curl to download the Cod4x
  • You should go get the Windows client from https://cod4x.me/
    • It is a patch to Call of Duty 4 Modern Warfare so you are able to se the server.
  • Works with custom mods and usermaps
  • You can find a sample file to a "server.cfg" file on github.
https://github.com/henkall/docker-cod4

Here is a example to get going with a server using compose.

---
version: "2"
services:
  cod4server:
    image: henkallsn/docker-cod4
    # Change the name if you want to.
    container_name: COD4DED
    network_mode: "host"
    environment:
      - READY=YES
      - EXECFILE=server.cfg
      - SERVERTYPE=1
      # This port can be changed. It is UDP.
      - PORT=28960
      - MAP=+map_rotate
      # Mod name can be empty
      - MODNAME=
      - EXTRA=+set sv_authorizemode -1
      - GETGAMEFILES=1
    volumes:
      # Remember to change this
      - /Path/to/COD4/gamefiles:/home/cod4/gamefiles

Note the files can be found in the installed game directory.

\Activision\Call of Duty 4 - Modern Warfare

Note the following.

The server.cfg file should be located in the main folder.

If you are running with a mod then the server.cfg file for that mod has to be in the same folder as the mod.

Host pathContainer pathNote
/path/to/COD4/gamefiles/home/cod4/gamefilesThis is where the main, zone, mods and usermaps folders is going to be
FoldersDescription
mainI copied the contents of this from my CoD4:MW
zoneI copied the contents of this from my CoD4:MW
ModsI keep any mods I want to use on the server in here
usermapsI keep my custom maps in here

Important:

The docker uses "EXECFILE", "PORT", "MAP", "MODNAME" and "EXTRA" enviroment variable to pass commands to the servers startup. It also uses the "READY" enviroment variable just to check if you want to do this. :) If Empty it won't start. Here is a list of commands that I use:

** Variable name **DescriptionValue
READYChecking if you are Ready. Server don't start if this is emptyYES
EXECFILEThe name of the config file that should be used. Placed in the "main" folder if you are not using mods. When mods is used you can place the file on the same folder as the mod.server.cfg
SERVERTYPE2 Is for Internet. 1 Is for LAN. If 2 is used you have to use: set sv_authtoken "mytokenhere" in the server.cfg file. You can read about it HERE.1
PORTSet what port the server should run on. If left empty this defaults to 2896028960
MAPStarts the server with the defined rotate sequens in server.cfg file.+map_rotate
MODNAMEDefines what mod you whant to use. Write the name of the folder that you mod is in. For example modernpaintball.$MODNAME$
EXTRA1 only allows players with legal copies to join, 0 allows cracked players, and -1 allows both types of players while the Activison authentication server is down.+set sv_authorizemode -1
GETGAMEFILESTells the server to get gamefiles or not. 1 is to get files. 0 is not to get files.1

Testing

  1. Run a COD4 client and try to connect to yourhostIPaddress:28960

OBS: If you can't see the server in the game then try to add the server ip to the favorites in Call of Duty server list. Remember the portnumber. Also check your filter so you allow it to show moded servers.

If you are running version 1.7 of the game then get the patch from https://cod4x.me/ (The Windows client download). This can be removed again if you don't want to use it anymore.

When server is up and running:

Then I will recomend running the container as User: cod4. Else it will run as root as default. This can be done with adding this to the stack under "container_name: COD4DED":

user: cod4

Tag summary

Content type

Image

Digest

Size

143.6 MB

Last updated

about 5 years ago

docker pull henkallsn/docker-cod4