This document provides an overview of setting up the Project Zomboid server using Docker.
You can use the provided compose.example.yml
file to run the server in a docker-compose
environment. To do so, follow these steps:
-
Ensure you have Docker and Docker Compose installed on your machine.
-
Navigate to the directory containing the
compose.example.yml
file. -
Run the following command to start the server:
docker compose -f compose.example.yml up -d
-
To stop the server, use:
docker compose -f compose.example.yml down
Note: The
compose.example.yml
file contains the default configuration for the server. You can modify the file to customize the server setup according to your requirements.
You can also run the server using the docker
command. To do so, follow these steps:
-
Ensure you have Docker installed on your machine.
-
Navigate to the directory containing the
compose.example.yml
file. -
Run the following command to start the server:
docker run -d --name zomboid -v zomboid_cache:/app -v zomboid_data:/data tordel/zomboid:latest
Or with ENV variables:
docker run -d --name zomboid -v zomboid_cache:/app -v zomboid_data:/data -e VERIFY=false -e AUTO_UPDATE=true -e MEM_LIMIT=8g -e PORT=16261 -e UDP_PORT=16262 -e SERVERNAME=servertest -e ADMIN_USERNAME=admin -e ADMIN_PASSWORD=admin -e GID=1000 -e UID=1000 tordel/zomboid:latest
-
To stop the server, use:
docker stop zomboid
This section describes how to ensure that data generated by the server persists across restarts.
- Ensure that you correctly configure the volumes in the
compose.example.yml
file to keep data safe. - The
zomboid_cache
andzomboid_data
volumes are used to store persistent data. - The
zomboid_cache
volume is used to store the server files, while thezomboid_data
volume is used to store the world save data.
Note: If Docker is installed as root and the container runs as an unprivileged user, the volumes should have permissions that specifically grant access to that user. For instance, you may set permissions to 700 for the corresponding $UID:$GID, provided that this configuration meets your application's security and functional requirements.
The following environment variables can be configured to customize your server setup:
- VERIFY: Set to
true
to verify the server files on startup. Default istrue
. - AUTO_UPDATE: Set to
true
to automatically update the server files on startup. Default istrue
. - MEM_LIMIT: Set the memory limit for the server. Default is
8g
. - PORT: Specify the port for the server to listen on. Default is
16261
. - UDP_PORT: Specify the UDP port for the server. Default is
16262
. - SERVERNAME: Set the name of the server. Default is
servertest
. - ADMIN_USERNAME: Set the username for the admin. Default is
admin
. - ADMIN_PASSWORD: Set the password for the admin. Default is
admin
. - GID: Set the group ID for the server. Default is
1000
. - UID: Set the user ID for the server. Default is
1000
.