Here's what you'll need:
- Any Linux container image with glibc, TLS certificates and a non-root user account
- An environment configured for running Linux containers
- Key considerations
- Implementation guidelines
An Unreal Engine dedicated server is a headless build of an Unreal project designed solely for handling game logic and network replication for multiplayer experiences. Client builds of the project connect to a dedicated server in order to share a common gameplay session.
Because dedicated servers do not perform any rendering, they do not require GPU acceleration, or even an Unreal Engine runtime image. Instead, they can run in any container image that provides the required system libraries and user configuration. For Linux containers, this means the image must include glibc and TLS certificates, and also provide a non-root user account since Unreal Engine applications refuse to run as the root user. The
cc-debian10:nonrootvariant of Google’s lightweight distroless base image is recommended due to its extremely small size and the fact that it provides a preconfigured non-root user account.
Dedicated servers primarily use the UDP protocol for communicating with clients. The networking stacks provided by container runtimes such as Docker introduce additional overheads that result in increased latency of UDP packets, so it is strongly recommended that you run Linux containers with host networking mode enabled in order to ensure the smoothest experience for users. Windows containers do not support host networking mode and will always suffer from increased UDP latency.
Running dedicated servers in Windows containers is not recommended, due to both the UDP latency issues mentioned above and the need for additional configuration steps as discussed in the Windows container compatibility section below.
Creating a Linux container image
Copying pre-packaged files into an image
If you have already packaged a dedicated server for Linux on the host system then you can simply copy these files into a distroless base image like so:
Note that the minimal nature of the distroless image means it does not include a shell like Bash to interpret shell scripts, and so the default startup script for the dedicated server (e.g.
MyProjectServer.sh) cannot be used as the container entrypoint. Instead, the container entrypoint needs to be configured to directly run the underlying executable for the dedicated server, including the command-line flags that would normally be passed to it by the startup script.
Performing a multi-stage build
If you would like to build the dedicated server inside a container then you can use a multi-stage build to perform the build process in an Unreal Engine development image and then copy the results to a distroless base image like so:
Windows container compatibility
Setting the application subsystem
As discussed in the blog post Offscreen rendering in Windows containers, Unreal Engine applications built for Windows are designed to act as graphical applications rather than command-line applications, which prevents them from running correctly inside containers. This also applies to dedicated server targets and must be fixed in the same manner as non-server targets, by instructing UnrealBuildTool to build an additional executable as a command-line application through the
bBuildAdditionalConsoleApp configuration value in the
When you package the dedicated server for your project, an additional executable with the suffix
-Cmd will be produced alongside the regular binary. For example, if your project is called “MyProject” and you packaged it in the Development configuration then you will see two executables named as follows:
MyProjectServer.exe: this is the executable built with the WINDOWS subsystem, and is not suitable for use in a container.
MyProjectServer-Cmd.exethis is the executable built with the CONSOLE subsystem, and is suitable for use in a container.
Despite not performing any rendering, dedicated servers still require the following Microsoft Media Foundation DLL files as of Unreal Engine 4.27:
These DLL files are not present in the Windows Server Core base image and will need to be copied from the Windows base image (prior to Windows Server 2022) or the Windows Server base image (for Windows Server 2022 and newer.)