Sign inSign up

burrowops/openttd

By burrowops

•Updated 4 days ago

Dedicated OpenTTD server

Image
0

249

burrowops/openttd repository overview

⁠OpenTTD Docker Version Docker Pulls Docker Stars

Dedicated OpenTTD⁠ server image. Based on bateau/openttd⁠ and linuxserver.io⁠ Ubuntu with s6-overlay.

dockeri.co

⁠Tags

Current tags are listed on Docker Hub⁠ (the badge above also shows the newest version).

TagMeaning
latestNewest published image
{major}Newest image for that OpenTTD major (for example 14, 15)
{version}Newest image for that OpenTTD release (for example 15.3)
{version}-{n}Rebuild of the same OpenTTD with newer bases (OpenGFX, Ubuntu, …)

{version} is the first image for that OpenTTD release. Later non-OpenTTD bumps are {version}-1, {version}-2, and so on. {version} and {major} keep moving to the newest rebuild.

⁠File locations

Mount a host path at /config. That volume holds everything that should survive a recreate:

PathPurpose
/config/openttd.cfgServer config (created on first run if missing)
/config/save/Savegames
/config/save/autosave/Autosaves (used by loadgame=last-autosave)

Edit openttd.cfg after the first start to set the server name, password, public listing, and so on.

⁠Environment variables

Defaults are baked into the image. Override with -e / Compose environment.

⁠Server
VariableDefaultMeaning
loadgamelast-autosaveWhat to load on start. See values below.
savepath/config/saveDirectory for savegames. Autosaves go in savepath/autosave.
savename(unset)Save filename when loadgame=true (for example game.sav). Do not use spaces.
configpath/configDirectory that contains the config file.
configfileopenttd.cfgConfig filename inside configpath.
debug0OpenTTD debug level (-d). See OpenTTD debug docs⁠.
⁠loadgame values
ValueBehaviour
falseStart a new game
trueLoad ${savepath}/${savename} (requires savename)
last-autosaveLoad the newest file in ${savepath}/autosave/ (default; falls back to a new game if none exist)
⁠linuxserver / permissions
VariableDefaultMeaning
PUID911User ID that owns /config. Set this to your host user (id -u).
PGID911Group ID that owns /config. Set this to your host group (id -g).
TZ(unset)Container timezone, for example Europe/Amsterdam.
UMASK022File-creation mask for files written under /config.

⁠Networking

PortRequiredPurpose
3979/tcpYesGame (default server_port)
3979/udpYesGame
3977/tcpNoRemote admin (server_admin_port in openttd.cfg)

Publish with -p 3979:3979/tcp -p 3979:3979/udp. Forward both protocols on your router if clients connect from the internet.

To appear on the public server list, set server_game_type = public in openttd.cfg (or use the in-game / rcon equivalent). Listing uses the Game Coordinator; you do not need to publish port 3978.

Control the running server with rcon⁠: set rcon_pw in openttd.cfg or via the dedicated-server console.

Give the process time to write exit.sav on stop (stop_grace_period: 30s in Compose, or docker stop -t 30).

⁠Docker run

Default (resume last autosave, or start a new game if none exist):

docker run -d \
  --name openttd \
  --restart unless-stopped \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/Amsterdam \
  -e loadgame=last-autosave \
  -v /path/to/openttd:/config \
  -p 3979:3979/tcp \
  -p 3979:3979/udp \
  burrowops/openttd:latest

New game:

docker run -d \
  --name openttd \
  --restart unless-stopped \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/Amsterdam \
  -e loadgame=false \
  -v /path/to/openttd:/config \
  -p 3979:3979/tcp \
  -p 3979:3979/udp \
  burrowops/openttd:latest

Load a named save (/path/to/openttd/save/game.sav):

docker run -d \
  --name openttd \
  --restart unless-stopped \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/Amsterdam \
  -e loadgame=true \
  -e savename=game.sav \
  -v /path/to/openttd:/config \
  -p 3979:3979/tcp \
  -p 3979:3979/udp \
  burrowops/openttd:latest

To pin a release, replace latest with a tag from Docker Hub⁠.

⁠Docker Compose

services:
  openttd:
    container_name: openttd
    image: burrowops/openttd:latest
    restart: unless-stopped
    stop_grace_period: 30s
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Amsterdam
      - loadgame=last-autosave
      # - savename=game.sav
      # - savepath=/config/save
      # - configpath=/config
      # - configfile=openttd.cfg
      # - debug=0
      # - UMASK=022
    volumes:
      - ./openttd:/config
    ports:
      - 3979:3979/tcp
      - 3979:3979/udp
      # Optional: remote admin port (server_admin_port in openttd.cfg)
      # - 3977:3977/tcp

A copy of this file lives at docker-compose.yml⁠. From the repo root:

docker compose up -d

⁠First run

  1. Start the container once so OpenTTD writes /config/openttd.cfg.
  2. Stop it (docker compose down or docker stop -t 30 openttd).
  3. Edit openttd.cfg (server name, password, server_game_type, rcon, NewGRFs).
  4. Start it again.

Savegame filenames must not contain spaces.

⁠Version updates

Renovate⁠ watches OpenTTD, OpenGFX, the linuxserver Ubuntu base, and GitHub Actions. Install the Renovate GitHub App on this repo. It opens (and auto-merges) PRs; after a docker/dockerfile change lands, CI publishes a new image.

A new OpenTTD release becomes {version}. A bump of only OpenGFX or Ubuntu becomes {version}-1, then {version}-2, and so on.

Tag summary

Content type

Image

Digest

sha256:1d4ccc732…

Size

171.5 MB

Last updated

4 days ago

docker pull burrowops/openttd