Public Repository

Last pushed: 7 days ago
Short Description
Open Transport Tycoon dedicated server.
Full Description

These images have been built and tested on docker 1.9.1. Previous versions may not run as smooth.

Usage

docker run -d -p 3979:3979/tcp -p 3979:3979/udp bateau/openttd:latest

For random port assignment replace

-p 3979:3979/tcp -p 3979:3979/udp

with

-P

Its set up to not load any games by default (new game) and it can be run without mounting a .openttd folder.
However, if you want to load your savegames, mounting a .openttd folder is required.

Set

-e "loadgame=exit" 

to enable loading of save/autosave/exit.sav.
For Openttd to save on exit you need to set "autosave_on_exit = true" in your openttd.cfg file under the [gui] section.

Set UID, GID and HOME of user in container to be the same as your user outside with seting env PUID, PGID and PHOME
For example

-e PUID=1001 -e PGID=1000 -e PHOME=/opt/openttd

For other save games use

-e "loadgame=true" -e "savename=your/save/game.sav"

Config files is located under /home/openttd/.openttd. To mount up your .openttd folder use

-v /path/to/your/.openttd:/home/openttd/.openttd

For example to run server and load my savegame game.sav:

docker run -d --name openttd -p 3979:3979/tcp -p 3979:3979/udp -v /home/<your_username>/.openttd:/home/openttd/.openttd -e PUID=<your_userid> -e PGID=<your_groupid> -e "loadgame=true" -e "savename=game.sav" bateau/openttd:latest

Other tags

  • 1.7.1-RC1
  • 1.7.0
  • 1.7.0-RC1
  • 1.6.1
  • 1.6.1-RC1
  • 1.6.0
  • 1.6.0-RC1
  • 1.5.3
  • 1.5.2
  • 1.5.1
  • 1.5.0
  • 1.4.4
  • 1.5.0-rc1
  • 1.5.0-beta2
  • 1.5.0-beta1
Docker Pull Command
Owner
bateau

Comments (14)
bateau
2 years ago

Hey @niekverw! that sounds a bit odd. i have not had those problems myself. what version of docker do you run and what tag of the image do you use?

Hello @pharserror! Im happy to be assisted, so please do contribute. you can do pull request on github (https://github.com/bateau84/openttd) :)

pharserror
2 years ago

Hey Bateau, would I also be able to join the contributors list? I have a lot of experience with Docker and I would be interested in making this build more modular. Let me know, thanks!

niekverw
2 years ago

I'm new to docker; and thought i'd try openTTD; The docker works, however I needed to start openTTD myself from within the container (e.g. with: docker exec -i -t ${dockerID} bash ; /usr/games/openttd -D -x ) as it doesn't start automatically, not sure why; thought i would let you know.

Could you tell me where the 'openttd.cfg' file is located? I couldn't find, it to edit some of the server settings.

Thanks!

bateau
2 years ago

New version pushed. 1.5.2 :)

frodus
2 years ago

I have stress tested the autosave function now, and it works very well every time! Both by just starting and stopping the docker container, but also by rebooting the OS. Good job!

bateau
2 years ago

So, i think i fixed the exit.sav issue.
As long as the config file is set to save on exit, and loadgame is set to "exit", it will save and load the correct files. New Tag is uploaded (1.5.1) with this "feature" implemented.

bateau
3 years ago

Yes, i know. I have not found a way to go around this. What i do, is to join the server and use rcon to shut it down properly.
Any help here would be appreciated.

frodus
3 years ago

Hi Bateau.
Thanks for updating to 1.5.0 of OPENTTD. I just noticed a bug regarding "save on exit".

If I attach to my container and manualy type "exit", then openttd will shutdown and create a exit.sav file. But if I run the "docker stop openttd" from my host, it seems like it kills my container before it has a chance to save.

I'll see if I find a way to fix this, but I just wanted to warn everyone about this if they rely on this functionality

bateau
3 years ago

Yes, didnt think of that. I build, test and run on docker version 1.5.0.
Will include in documentation.

frodus
3 years ago

I have had multiple strange errors running on a "old" docker version. What version have you been testing on? 1.0.1 seems not to work very well, but 1.5.0 works perfect. Could you update the descriptions with recommended version?