Skip to main content

Creating a Dockerfile for your server

Hathora Cloud utilizes Docker, which is a technology that allows you to package your server project in a portable way so that it can be run in any Linux environment.

In order to deploy on Hathora Cloud, you will need to provide a Dockerfile in the root of your tar file:

tar.gz file
├── Dockerfile
└── <...your server build/project files>
note

You will not need to have Docker installed on your machine, the Docker build happens on Hathora build servers.

The core structure of a Dockerfile contains:

  1. Base OS and packages (FROM)
  2. Copy project files into container (COPY)
  3. Configure build steps (RUN) - can skip if you've already copied a Linux executable in step 2
  4. Start command (CMD)
FROM ubuntu:22.04

# Add these dependencies to enable your server to make outbound TLS requests
RUN apt-get update && \
apt-get install -y ca-certificates && \
update-ca-certificates

# Copy the server build files into the container, if Dockerfile is @ parent
COPY ./Server-Build-Dir .

RUN chmod +x ./your_unity_server.x86_64


# Run the Linux server in headless mode as a dedicated server
CMD ./your_unity_server.x86_64 -mode server -batchmode -nographics

Check out our detailed onboarding guide for Unity.

Join our developer community!