Call of Duty 4 Dedicated Server based on COD4x 1.7a
10K+
Call of Duty 4 Dedicated Server based on COD4x 1.7a as Docker image
It is based on:
./mainexec server.cfgWe 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 ./usermapsAs 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 zone usermaps
You can also run the container with --user="root" (unadvised!)
Run the following command as root user on your host:
docker run -d --name=cod4 -p 28960:28960/udp -p 28960:28960/tcp \
-v $(pwd)/main:/home/user/cod4/main \
-v $(pwd)/zone:/home/user/cod4/zone:ro \
-v $(pwd)/mods:/home/user/cod4/mods \
-v $(pwd)/usermaps:/home/user/cod4/usermaps:ro \
-e CHECK_PORT=28960 \
-e CHECK_IP=127.0.0.1 \
freekers/docker-cod4x17a +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
There are two types of restarts:
If the container would stop for some reason (e.g. ShutdownGame) - Docker will restart it automatically ('restart' part in docker-compose.yml)
If for some reason the container would still run, but the healthcheck fails (e.g. the CoD4 server process is fronzen), the Docker container will be marked as 'unhealthy'. However, in this case, the container wouldn't be restarted automatically by Docker. For this you need an additional Docker image called autoheal. Here's a docker-compose.yml example for autoheal:
version: '3.7'
services:
autoheal:
image: willfarrell/autoheal
container_name: autoheal
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
AUTOHEAL_CONTAINER_LABEL: "all"
AUTOHEAL_CONTAINER_LABEL with value "all" means that all unhealthy containers would be restarted.
If you change the default server port, i.e. 28960, then make sure the CHECK_PORT in your Docker run command or docker-compose matches your net_port.
If you change net_ip, then make sure the CHECK_IP in your Docker run command or docker-compose matches your net_ip.
192.168.1.26)
192.168.1.26:28961)
Assuming:
./mymod./mymod/server.cfgSet 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 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, requires host network mode+set net_port 28961 don't use if not needed, requires host network mode+map_rotate OR i.e. +map mp_shipment should be the last launch argumentIn order for the server to show up on the Activision Masterlist, you need to use host network mode for the container so that it can bind to the WAN/Internet IP address of your server. Additionally, you need to set +set net_ip 123.123.123.123 +set net_port 28961 as ARGS environment variable.
If using bridge network mode, the container will bind to the IP address of the Docker network and therefore won't show up on the Activision Masterlist, as the heartbeat will send a 'local' IP-address to the Masterserver (e.g. 172.16.X.X.).
Note: This version of COD4x (1.7a) is no longer compatible with the COD4x Masterserver as it now requires a token to be listed, which has not been implemented/backported to COD4x version 1.7a.
Content type
Image
Digest
sha256:be2216c34…
Size
142.9 MB
Last updated
16 days ago
docker pull freekers/docker-cod4x17a