Container builds

A container is a way of packing software and all of its dependencies together in a single unit. Game Server Hosting (Multiplay) container builds allow you to package your game servers and their dependencies, build a container, and push it to the Game Server Hosting container registry.

You can create a container build through the Unity Dashboard by selecting Container image when you create a build. The Create build wizard walks you through adding a service account, adding the registry, and selecting an image. See Create a build with a container image.

Game Server Hosting uses Docker container tags in the format <ImageName>:<ImageTag>. Game Server Hosting generates the correct name and tag for your build, and displays it to you in the Unity Dashboard when you create or update a container build.

Copy
docker tag <ImageName>:<ImageTag> registry.multiplay.com/4818982f-bb28-4c39-9d44-628204b6780e/1ae4de65-849d-4ff1-86fc-1de3bdfbd891/12788:v1
Note: Game Server Hosting only generates the ImageName and ImageTag for you when you create a build through the Unity Dashboard. If you use the CLI tool, you’ll need to create the ImageName and ImageTag.

Container build requirements

When you create a Game Server Hosting (GSH) build, you have several options for uploading your build file. One option is to use Docker and the GSH container registry to upload a containerized version of your build. However, your build container must meet specific requirements (in addition to the General requirements) before you can use a containerized build.

Create a container built with the base image

The linux-build-image template container takes care of most of the additional requirements of using a container build. You can use it by adding the following line to the top of your Dockerfile:

Copy
FROM unitymultiplay
/
linux-base-image:<tag>

Replace <tag> with the version of the base image to use. You can check the linux-base-image tags for a list of available tags.

Create a container build from scratch

If you prefer to create your Dockerfile from scratch, it’s your responsibility to ensure your container meets the following requirements.

Warning: You should use the base image unless you have a very specific or advanced use case in which you must create the container from scratch.
Requirement Description
USER mpukgame Your container must use mpukgame as the USER. This user must have a group identifier (GID) of 2000 and a user identifier (UID) of 2000.
ENTERYPOINT Your container must have an ENTRYPOINT.

The following code block shows a simple Dockerfile that meets these requirements:

Copy
# ======================================================== #
#                  Unity base image stuff                  #
# ======================================================== #

FROM ubuntu:20.04 AS mpuk

RUN addgroup --gid 2000 mpukgame && \
    useradd -g 2000 -u 2000 -ms /bin/sh mpukgame && \
    apt upgrade && \
    apt update && \
    apt install -y ca-certificates
USER mpukgame

# ======================================================== #
#                    Custom game stuff                     #
# ======================================================== #

FROM mpuk AS game

# copy game files here
# for example:
WORKDIR /game
COPY --chown=mpukgame . .

# set your game binary as the entrypoint
ENTRYPOINT [ "./gamebinary" ]