Unreal on Docker
#
PrerequisitesTo 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.
#
Steps#
Getting the Unreal Engine base imagesUnreal 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.0You 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.0Follow 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 DockerfileAt the root of your project, in the same folder where you can find your .uproject
file,
create a new file called Dockerfile
(no extension) and put the following content.
Make sure to replace the <PLACEHOLDER_VALUES> with the proper values:
Placeholder | Expected value | Example |
---|---|---|
<YOUR_UE_DEV_IMAGE> | The dev image you pulled or created from source | ghcr.io/epicgames/unreal-engine:dev-4.27.2 |
<YOUR_UE_RUNTIME_IMAGE> | The runtime image you pulled or created from source | ghcr.io/epicgames/unreal-engine:runtime |
<YOUR_PROJECT_NAME> | 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. For a list of the available options, you can run
the following command in Unreal's Automation Tool (usually located at
<UE_INSTALLATION_FOLDER>/Engine/Build/BatchFiles
):
#
Build, tag and push your imageWe 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
And voilà !
You now have a containerized game server, ready to be deployed with Arbitrium.
Next steps:
- Create your game profile if you didn't already.
- Deploy your game server.
- Setup a matchmaker for your game.