Appearance
Docker
This guide covers running Encore Server as a Docker container on Ubuntu 24.04.
Build the image
From the repo root:
bash
docker build -t encore-server ./serverTo customize the game port range documented in the image metadata, use the GAME_PORT_RANGE build arg (default: 7000-7099):
bash
docker build --build-arg GAME_PORT_RANGE=5000-5999 -t encore-server ./serverThis only affects EXPOSE metadata. The ports you actually publish at runtime must match ENCORE_PORT_POOLS.
Environment variables
Configuration is generated from environment variables at container startup. A config file is written to /etc/encore/config.toml before the server starts.
| Variable | Required | Default | Description |
|---|---|---|---|
ENCORE_ID | yes | — | Server identifier (encore_XXXXXXXXXX) — generate with encore install |
ENCORE_ADMIN_TOKEN | yes | — | Admin API authentication token |
ENCORE_PORT_POOLS | no | — | Comma-separated port ranges, e.g. 7000-7099,7100-7199 |
ENCORE_PUBLIC_HOST | no | 127.0.0.1 | Public hostname or IP returned to game clients |
ENCORE_BIND | no | 0.0.0.0:8080 | HTTP listen address |
ENCORE_UPLOAD_FOLDER | no | /var/lib/encore/uploads | Directory for uploaded game server binaries |
ENCORE_MAX_UPLOAD_SIZE | no | 524288000 (500 MiB) | Maximum upload size in bytes |
Running the container
bash
docker run -d \
--name encore \
-e ENCORE_ID=encore_AbCdEfGhIj \
-e ENCORE_ADMIN_TOKEN=your-secret-token \
-e ENCORE_PORT_POOLS="7000-7099" \
-e ENCORE_PUBLIC_HOST=game.example.com \
-p 8080:8080 \
-p 7000-7099:7000-7099/udp \
-v /opt/gameservers:/opt/gameservers:ro \
-v /etc/encore/templates:/etc/encore/templates \
-v /var/lib/encore/uploads:/var/lib/encore/uploads \
encore-serverThe game server binaries and template files live on the host. Mount them into the container so paths declared in your templates resolve correctly.
If you use the binary upload API (POST /api/v1/uploads), the uploads and templates volumes must be writable. Uploaded binaries are stored in the upload folder and template CRUD writes .toml files to the template folder.
Docker Compose
yaml
services:
encore:
image: encore-server
build:
context: ./server
args:
GAME_PORT_RANGE: "7000-7099"
environment:
ENCORE_ID: encore_AbCdEfGhIj
ENCORE_ADMIN_TOKEN: your-secret-token
ENCORE_PORT_POOLS: "7000-7099"
ENCORE_PUBLIC_HOST: game.example.com
ports:
- "8080:8080"
- "7000-7099:7000-7099/udp"
volumes:
- /opt/gameservers:/opt/gameservers:ro
- /etc/encore/templates:/etc/encore/templates
- /var/lib/encore/uploads:/var/lib/encore/uploads
restart: unless-stoppedcgroup v2 isolation
If your templates use [template.isolation.cgroup], the container needs the SYS_ADMIN capability to create and manage cgroup v2 subgroups:
bash
docker run --cap-add SYS_ADMIN ...Or in Compose:
yaml
cap_add:
- SYS_ADMINWithout this capability, instances that require cgroup isolation will fail to spawn. Templates without isolation are unaffected.
Validate and smoke-check
Once the container is running:
bash
# Health check
curl http://localhost:8080/health
# List templates (requires admin token)
curl -H "X-Admin-Token: your-secret-token" \
http://localhost:8080/api/v1/templatesCommon pitfalls
ENCORE_PUBLIC_HOSTmust be set to a host reachable by game clients — the default127.0.0.1is only useful for local testing.- The UDP port range in
-pmust matchENCORE_PORT_POOLSexactly. Mismatches result in unreachable game server ports. - Game binary paths in template files must resolve inside the container. Use the same absolute path for both the volume mount target and the
binary_pathin your template.
