To containerize your Unreal game server, you will need:
A working Unreal game server build
If you don't have a server ready, or your server is not yet ready to build, see Unreal Engine's documentation for setting up dedicated servers to rapidly setup a working client-server game.
You should be able to launch your game server locally and connect to it from your game client.
Docker installed on your computer
If it is not already intalled, see the Docker installation guide.
A GitHub account and an Epic Games account, linked
This should technically already be done as you need to build Unreal Engine from source to compile a game server. If it is not, here's how to proceed:
In your Epic account page, find the "Connections" tab. You should then see the option to link your account to GitHub. Upon linking your accounts, you should receive an email allowing you to join the Epic Games organization on GitHub. When joined, you will gain access to their repos and packages.
Getting the Unreal Engine base images
Unreal Engine v4.27.0 and later have publicly accessible container images for the Unreal Engine, so that you don't have to create the image from source.
For Unreal Engine < 4.27.0
You will need to build an Unreal Engine image from source. Be aware that the process takes a lot of time and disk space, so we recommend doing it overnight. Read the documentation for building Unreal images from source for a detailed guide.
For Unreal Engine ≥ 4.27.0
Follow steps 4 and 5 of the Unreal documentation to authenticate to ghcr.io and pull the public Unreal Engine images for your needs. In most cases, you will need both a dev and a runtime image, but you can refer to this page for more information on the available image types and features.
Writing the Dockerfile
At the root of your project, in the same folder where you can find your
create a new file called
Dockerfile (no extension) and put the following content.
# We will be using Unreal Editor's built-in automation tool to include as little third
# party software as possible.
# We will be using a Linux container for this exmaple, but please review the specific
# features availability for each contianer type and choose accordingly:
# Support for other container types (e.g. Windows containers) is not currently guaranteed.
# 1. Create a development image with the tools required to package your server.
FROM <YOUR_UE_DEV_IMAGE> AS builder
COPY --chown=ue4:ue4 . /tmp/project
# You may want to review the arguments listed below and change them as required by running `RunUAT BuildCookRun -Help`
# where applicable (the RunUAT executable is found in Unreal Editor's installation directory, under Engine/Build/BatchFiles/)
RUN /home/ue4/UnrealEngine/Engine/Build/BatchFiles/RunUAT.sh BuildCookRun \
# 2. Create a Runtime image from the packaged server.
COPY --from=builder --chown=ue4:ue4 /tmp/project/dist/LinuxServer /home/ue4/project
ENTRYPOINT ["/home/ue4/project/<YOUR_PROJECT_NAME>.sh", "-log"]
Make sure to replace the
<PLACEHOLDER_VALUES> with the proper values:
|The dev image you pulled or created from source||ghcr.io/epicgames/unreal-engine:dev-4.27.2|
|The runtime image you pulled or created from source||ghcr.io/epicgames/unreal-engine:runtime|
|The name of your project||MyDemoGame|
This Dockerfile serves as a base template. You may need to adjust it to suit your server's requirements.
You can run the following command in Unreal's Automation Tool for a list of available options. The tool usually located at
./RunUAT BuildCookRun -Help
Build, tag and push your image
We recommend using our private container image registry for hosting your built image.
Be aware that you should not distribute any Unreal Engine image publicly as this is against their EULA. For more information on that matter, read Unreal Engine's EULA (section 1A specifically) and/or UnrealContainer's summary of the relevant points of the former
You now have a containerized game server, ready to be deployed with Arbitrium.