Base image for making linux container game servers for the Unity Multiplay platform.
10K+
Unity Technologies maintains the linux-base-image for customers using the Game Server Hosting (GSH) service. Visit the following links to get help:
The linux-base-image is a base Docker image for Unity Game Server Hosting (GSH) customers using container builds. It takes care of the additional requirements of using a container build, such as setting mpukgame as the container user with the correct permissions and ownership and adding GSH dependencies.
However, it does not work “out of the box.” You must fill in information specific to your build, such as your build entrypoint (executable), any dependencies, and your build container logic. See Getting started.
Note: 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.
To start your container build with the linux-base-image, add the following lines to the top of your Dockerfile:
FROM unitymultiplay/linux-base-image:<tag>
Note: 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.
Then, expand it to run your game build by:
Install any apt packages required.
Note: You will need to change user to root for the install, and then back to mpukgame for your game to function properly.
USER root
RUN apt-get update && apt-get install -y \
pkg-1 \
pkg-2
USER mpukgame
Add your game files and perform any additional setup your build might need.
WORKDIR /game
COPY . .
RUN ./init.sh
Define how you start your container by setting the ENTRYPOINT. In most cases, you should set the ENTRYPOINT to the path of your game executable, along with any required arguments or flags that do not need to change between build configurations or game allocations. GSH adds launch parameters to the end of the ENTRYPOINT when your game server container starts.
Note: The ENTRYPOINT is fixed; you cannot replace it later with launch parameters or any other means through the GSH platform.
ENTRYPOINT [ "/path/to/binary" ]
You can also use CMD to set arguments up for local testing. CMD is not fixed and will be replaced by the launch parameters in your build configuration when your game server container starts, so it’s not ideal to use for production (in most cases).
CMD [ "--default", "args", "here" ]
Note: For advanced cases, you can use CMD instead of ENTRYPOINT to share a build between multiple build configurations, each with a different build executable.
The following code block shows a complete example of a Dockerfile using the base image.
# Start from this base image, based on Ubuntu LTS.
FROM unitymultiplay/linux-base-image:1.0.1
# Install dependencies.
USER root
RUN apt-get update && apt-get install -y \
pkg-1 \
pkg-2
USER mpukgame
# Set up a working directory.
WORKDIR /game
# Add your game files and perform any required init steps.
COPY . .
RUN ./init.sh
# Set your game entrypoint.
ENTRYPOINT [ "/path/to/binary" ]
CMD [ "--default", "args", "here" ]
To test your Dockerfile locally, run docker build <path>, where <path> is the location of your Dockerfile. See the Docker command reference for more information.
Content type
Image
Digest
sha256:579d46e32…
Size
74.6 MB
Last updated
4 months ago
docker pull unitymultiplay/linux-base-image