Skip to content

underaft/zomboid-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Zomboid Docker Server

This project aims to make easy deploying Project Zomboid servers using Docker.

The container runs as a non-root user.

The default USER_ID is 1000 but you can change it inside docker-compose.yaml

Please, submit your issues and pull requests if you want to contribute.

How to use

Your server can be customized using Environment Variables (see below). Once you have what you want just use to deploy your server.

For B41: docker compose up -d --build server-b41 For B42: docker compose up -d --build server-b42

The server will create two persisten volumes:

  • zomboid-data: Here will live your actual Server, Saves, Logs...

WARNING Please note that B42 "server" is launched using Project Zomboid game, this means you have to purchase the game.

When deploying a B42 Server, you can copy your whole game contents into .pz-game folder, this is the optimal way because your final Dockerfile will contain everything it needs to run.

But if you want to use an actual mount point, you can do it too. This can be done either tweaking docker-compose.yaml or by creating a docker-compose.override.yaml file with the following contents:

Example for a NFS

Let's say you copied your game on a NFS to use anywhere This is very useful when you are running the server outside the computer where you play.

services:
  server-b42:
    volumes:
      - type: volume
        source: b42-game
        target: /home/steam/pz-game
        read_only: false
        volume: { }
volumes:
  b42-game:
    name: "zomboid-game-b42"
    driver: local
    driver_opts:
      type: nfs4
      o: "addr=IP_OF_YOUR_NFS,rw,noatime,tcp,timeo=10"
      device: ":MOUNT_POINT_OF_YOUR_NFS"

Example for a local mount point

Let's say you copied your game on a NFS to use anywhere This is very useful when you are running the server outside the computer where you play.

services:
  server-b42:
    volumes:
      - type: volume
        source: b42-game
        target: /home/steam/pz-game
        read_only: false
        volume: { }
volumes:
  b42-game:
    name: "zomboid-game-b42"
    driver: local
    driver_opts:
      type: none
      device: "PATH_TO_YOUR_GAME" # For example: "${HOME}/SteamLibrary/steamapps/common/ProjectZomboidB42/projectzomboid"
      o: bind

Environment variables

You should create an .env file

1. Docker Configuration

Your docker container can be tweaked, so it suits your needs via some variables located in Dockerfile and root_fs/scripts/entrypoint.sh

Name Description Default
STEAM_GAME_DIR Folder where B42 Game resides ${HOME}/${STEAMAPP}-game
SERVER_DEDICATED_DIR Folder where B41 Steamapp dedicated server is located "${HOME}/${STEAMAPP}-server"
LIVE_SERVER_DIR A symbolic link to the current server build, entrypoint.sh will execute the login under this directory. "${HOME}/live-server"
PERSISTENT_DATA_DIR The current server persisten files (-cachedir server argument) "${HOME}/Zomboid"
SERVER_BASE_DIR Folder where your server configuration files resides. "${PERSISTENT_DATA_DIR}/Server"
BACKUPS_BASE_DIR Server backups folder "${PERSISTENT_DATA_DIR}/Backups"
SAVES_BASE_DIR Server saves folder "${PERSISTENT_DATA_DIR}/Saves"
LOGS_BASE_DIR Server logs folder

They allow the server startup with some customization right away

Name Usage Default
COOP -coop false
NOSTEAM -nosteam false
SEED -seed nil
DEBUG -debug false
ADMINUSERNAME -adminusername admin
ADMINPASSWORD -adminpassword zomboid
SERVERNAME -servername ServerTest
STATISTIC_TIME -statistic 30
MODFOLDERS -modfolers workshop,steam,mods
IP -ip nil
STEAMVAC -steamvac true
MAX_MEMORY -Xmx${MAX_MEMORY} 4g

3. Server versioning

By default, the game runs on B41, but you can choose B42 with B42MP

Name Description Default
FORCEUPDATE Updates the server before running false
B42 Enables B42 false
B42MP Enables B42 and B42MP Death Legion Mod false

4. Server configuration (server.ini file) See Wiki

When the server is first loaded, it creates some files that can be configured later.

The location of the whole server is under PERSISTENT_DATA_DIR (see 4. Docker Configuration) variable which

To make things easy, we have tried to automate this task by using the prefix SRVENV_ and using the content of every variable into the server .ini file.

For example SRVENV_USE_STEAM_NETWORKING=true will set UseSteamNetworking=true inside our configuration file.

It should work with every single variable, here are some more examples

Name Config target
SRVENV_PUBLIC_NAME=FooBar PublicName=FooBar
SRVENV_MOD_IDS=MoreDescriptionForTraits4166;MinimalDisplayBars;MapLegendUI PublicName=FooBar
SRVENV_WORKSHOP_ITEMS=2685168362;2004998206;2710167561 PublicName=2685168362;2004998206;2710167561
SRVENV_MAP=Random Map, St Map=Random Map, St

You get the idea.

Extra stuff

Inside root_fs/configs you can see some files

  • ProjectZomboid64.B41.json: B41 server launcher config
  • ProjectZomboid64.B42.json: B42 server launcher config
  • ProjectZomboid64.B42MP.json: B42 + B42MP configuration for the server launcher
  • ProjectZomboid64.B42MP.client.json: Used in order to launch B42MP on the client side

Let's say you deploy a B42MP server, and you want your client to connect.

Once your client has downloaded B42MP

Then copy ProjectZomboid64.B42MP.client.json into your game folder and launch the game from steam with the following argument -pzexeconfig ProjectZomboid64.B42MP.client.json

You can also add +connect SERVER_IP:SERVER_PORT to instantly connect to your server

About

Project Zomboid Server Dockerized for B41 and B42

Topics

Resources

License

Stars

Watchers

Forks