Author: Moritz Petzka • petzka.com • info@petzka.com
Unreal Engine dedicated Linux server as Docker container with included Django backend and database for admin tools and dynamic REST-API
- Headless Unreal Engine dedicated server
- Docker and Docker Compose support
- Persistent volume for saved data/logs
- Configurable map, port, and logging
- Minimal base image (Ubuntu 22.04)
- Docker and Docker Compose
- Access to Unreal Engine GitHub repository
- Linux or WSL with required build tools
# Unreal server
PROJECT_NAME=YourProjectName
UE_PORT=7777
UE_MAP=LobbyMap
UE_LOGGING=1
# Database settings
DB_NAME=uegame
DB_USER=admin
DB_PASSWORD=securepassword
# Optional: superuser for Django admin
CREATE_SUPERUSER=1
DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_EMAIL=admin@example.com
DJANGO_SUPERUSER_PASSWORD=admin123
# UnrealEngine Build
UNREAL_VERSION=5_6
BUILD_CONFIG=Shipping
PROJECT_DIR=UnrealProjects/YourProjectName
ARCHIVE_DIR=Packaged/YourProjectName
UNREAL_ENGINE_PATH=UnrealProjects/UnrealEngine
Use Unreal Editor or automation tools to package your project as a Linux dedicated server, then place the output in the GameServer/
folder.
docker-compose build
docker-compose up -d
This will expose the server on port 7777 (UDP) and 15000 (TCP by default).
docker-compose down
To remove containers, networks, and volumes (careful with Saved/ data):
docker-compose down -v
File structure overview:
~/UnrealEngineGameServer/ # This respoitory
├── Saved/
├── logs/
├── UnrealProjects/ # Contains source code for project build
│ ├── UnrealEngine/
│ │ └── ...
│ ├── YourProjectName/
│ │ ├── Binaries/
│ │ ├── Content/
│ │ ├── Config/
│ │ ├── Source/
│ │ └── YourProjectName.uproject
In Linux (or use subsystem on windows), run:
sudo apt update
sudo apt install clang lld cmake make git build-essential libncurses5 libssl-dev libx11-dev \
libxcursor-dev libxinerama-dev libxrandr-dev libxi-dev libglib2.0-dev libpulse-dev \
libsdl2-dev mono-devel dos2unix unzip
*(GitHub access to offical UnrealEngine repository needed )
mkdir -p ~/UnrealProjects
cd ~/UnrealProjects
-
Option A: Clone UnrealEngine via SSH
git clone --depth=1 -b 5.6 git@github.com:EpicGames/UnrealEngine.git
-
Option B: Clone UnrealEngine via HTTP
git clone --depth=1 -b 5.6 https://github.com/EpicGames/UnrealEngine.git
cd ~/UnrealProjects/UnrealEngine
./Setup.sh
./GenerateProjectFiles.sh
make
This builds the Unreal Engine Linux version in WSL. It will take a long time.
mkdir -p ~/UnrealProjects/YourProjectName
Copy your Windows project into this directory or clone from a repo
cd ~/UnrealProjects/UnrealEngine
sudo chmod +x Scripts/build.sh
sudo chmod +x Scripts/clean_build.sh
sudo chmod +x Scripts/gen_server_target.sh
sudo chmod +x Scripts/copy_project_files.sh
# Rebuild C++ code only (fast)
./Scripts/build.sh code
# Only blueprint changes
./Scripts/build.sh blueprints
# Full cook for content changes (no code changes)
./Scripts/build.sh content
# Build server binaries
./Scripts/build.sh server
# Full package (default)
./Scripts/build.sh full
# Clean build
./Scripts/clean_build.sh
Mode | Description | Cook | Build | Pak | Archive |
---|---|---|---|---|---|
code |
C++ only, no cook/pak/archive | ❌ | ✅ | ❌ | ❌ |
blueprints |
Blueprint change only | ✅ | ❌ | ✅ | ❌ |
content |
Content-only changes | ✅ | ❌ | ✅ | ❌ |
server |
Server binaries only (new mode) | ❌ | ✅ | ❌ | ❌ (manual copy) |
full |
Full cook + pak + archive | ✅ | ✅ | ✅ | ✅ |
YourProjectNameServer is auto-generated when you enable Dedicated Server support.
Ensure you have bUsesSteam=false
(if you're not configuring Steam) in DefaultEngine.ini under OnlineSubsystem.
./Scripts/gen_server_target.sh
This creates a file like:
// YourProjectNameServer.Target.cs
using UnrealBuildTool;
using System.Collections.Generic;
public class YourProjectNameServerTarget : TargetRules
{
public YourProjectNameServerTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Server;
DefaultBuildSettings = BuildSettingsVersion.V2;
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_6;
ExtraModuleNames.Add("YourProjectName");
}
}
Run the following in your project folder, e.g.:
cd ~/UnrealProjects/YourProjectName
Then delete the following folders:
rm -rf Binaries/ Intermediate/ DerivedDataCache/ Saved/
~/UnrealProjects/UnrealEngine/Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh \
-project="$(pwd)/YourProjectName.uproject" -game
Clean Build Cache (Optional if Build Breaks or Conflicts)
cd ~/UnrealProjects/YourProjectName
# Remove cached build files
rm -rf Binaries/ Intermediate/ DerivedDataCache/ Saved/
# Optional: Clean Unreal's build state
./UnrealProjects/UnrealEngine/Engine/Binaries/DotNET/UnrealBuildTool.exe -Clean
docker-compose down
docker-compose up --build
If you're just rebuilding code and not changing content:
./UnrealProjects/UnrealEngine/Engine/Binaries/DotNET/UnrealBuildTool.exe -Clean
rm -rf Saved Intermediate DerivedDataCache
docker-compose down
docker-compose up --build
(DjangoBackend/config/entities.json)
{
"Player": {
"fields": {
"username": "CharField(max_length=50, unique=True)",
"email": "EmailField()",
"score": "IntegerField(default=0)",
"is_active": "BooleanField(default=True)"
}
},
"Match": {
"fields": {
"match_id": "CharField(max_length=32, unique=True)",
"start_time": "DateTimeField()",
"end_time": "DateTimeField(null=True, blank=True)",
"winner": "ForeignKey('Player', on_delete=models.DO_NOTHING, null=True)"
}
},
... add more fields if needed
}
-
e.g.
Compile Module.GeometryCollectionEngine.2.cpp In file included from /home/<username>/UnrealEngineGameServer/UnrealProjects/UnrealEngine/Engine/Intermediate/Build/Linux/x64/UnrealEditor/Development/GeometryCollectionEngine/Module.GeometryCollectionEngine.2.cpp:19: /home/jodermo/UnrealEngineGameServer/UnrealProjects/UnrealEngine/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionSceneProxy.cpp:43:10: fatal error: 'GeometryCollectionSceneProxy.ispc.generated.h' file not found 43 | #include "GeometryCollectionSceneProxy.ispc.generated.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
Install ispc
cd ~/Downloads wget https://github.com/ispc/ispc/releases/download/v1.23.0/ispc-v1.23.0-linux.tar.gz tar -xvzf ispc-v1.23.0-linux.tar.gz cd ispc-v1.23.0-linux sudo cp bin/ispc /usr/local/bin/ ispc --version