Git Product home page Git Product logo

docker_openttd's Introduction

Containerised OpenTTD

An image brought to you by /r/openttd

Build Stable Build Testing

Built from OpenTTD source to provide the leanest, meanest image you'll come across for putting trainsets in containers.

Image Names & Tags

The CI system will automatically build the current latest versions at 3AM every day. This is a little hacky, but it does mean we get new builds within 24 hours of release.

You can find the images at the following locations:

Registry URI
prefer Github Container Registry ghcr.io/ropenttd/openttd:{tag}
deprecated Docker Hub docker.io/redditopenttd/openttd:{tag}

Please prefer the Github Container registry for new deployments. It's 100% compatible with your Docker installation.

Tag Description
stable The latest stable release of OpenTTD.
latest As stable
Major Version The latest stable release for this major version (i.e 7 may point to 7.1.2)
testing The latest unstable release of OpenTTD, including betas and release candidates.
nightly Reserved (if you need this, raise an issue!)

Architectures

Images are built for AMD64 (x86_64, i.e 64bit PC) and ARM64 (modern ARM, i.e Raspberry Pi 3 running 64-bit OS).

If you need an architecture not listed above, please raise an issue.

Using this Container

Docker

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

The container is set by default to start a fresh game every time you restart the container. You can, however, change this behaviour with the loadgame envvar:

-e "loadgame={false|last-autosave|exit|(savename)}"

where:

  • false: standard behaviour, just start a new game
  • last-autosave: load the last chronological autosave
  • exit: try to load autosave/exit.sav, otherwise default to a new game
  • (savename): full name of a save file in config/saves

You'll probably want stuff to be persistant between container rebuilds, so we've got the /config volume for exactly that purpose.

-v /home/{username}/.openttd:/config:rw

Heads up: If we can't find an openttd.cfg in /config, we'll attempt to ask OpenTTD to start a new configuration directory there. We strongly recommend that if you're starting fresh, you stop the container and configure openttd.cfg as per the wiki.

If you don't want the entire .openttd directory to be copied to your local FS statically, you may want to consider mounting files / directories directly like so:

-v /home/{username}/.openttd/openttd.cfg:/config/openttd.cfg:ro
-v /home/{username}/.openttd/save/:/config/save:rw

The easiest way to play with NewGRF's is to first download and configure them how you want on a local machine with a GUI. Then in the config/ directory copy the folder from local machine named content_downloaded to the server. Next update the openttd.cfg file from your local machine, this is to ensure that when you create a new server your NewGRF settings will be copied across.

An example command to start a server

docker run -it -p 3979:3979/tcp -p 3979:3979/udp -v /home/{username}/.openttd:/config:rw -e "loadgame=game.sav" redditopenttd/openttd:latest

This will start a server with the console accessible due to -it in the command line, to run in the background use -d.

podman

Replace all of the docker commands in the docker section with podman. If you're having issues, please raise an issue.

Kubernetes

Because OpenTTD is quite heavily stateful, we have written some handy helper containers for you to use as init containers and sidecars. Please see the openttd_k8s-helpers repo for more information.

docker_openttd's People

Contributors

agrund avatar alemansec avatar duckfullstop avatar jamezjb avatar lionzxy avatar mijndert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

docker_openttd's Issues

save - file not writable

Hi I am trying to host this docker container and keep getting save issues.
I launch it using the following.

sudo docker run -it --rm -p 3979:3979/tcp -p 3979:3979/udp -v /home/admin/.openttd:/config --name openttd-NAB redditopenttd/openttd:latest

it keeps failing the save

[2021-05-19 17:06:40] dbg: [sl] Game Save Failed File not writable [2021-05-19 17:06:40] ERROR: Autosave failed

I have been playing with volume permissions etc but have not had any luck.

config file overwritten on startup

Every time i startup the container my config files get overwritten. From looking at my mounted volumes,, the config files have been split up and changed location in the latest version from "/config" to "/config/.config". I couldn't find anything in the openttd documentation, but it seems to be happening.

openttd.cf and private,cfg are in ~/openttd
Here is the log from a startup:

$ ~/openttd/.config$ docker run --name openttd -it -p 3979:3979/tcp -p 3979:3979/udp -v ~/openttd:/config:rw -e loadgame=xxx.sav" redditopenttd/openttd:latest
**No config file found: generating one**
Loading /config/save/xxx.sav
dbg: [net] Starting dedicated server, version 13.0
dbg: [net] Starting network
dbg: [net] Initializing UDP listeners
dbg: [net] Network online, multiplayer available
dbg: [net] Detected broadcast addresses:
dbg: [net]   0) 172.17.255.255
[2023-03-30 21:07:03] OpenTTD Game Console Revision 7 - 13.0
[2023-03-30 21:07:03] ------------------------------------
[2023-03-30 21:07:03] use "help" for more information.
[2023-03-30 21:07:03]
[2023-03-30 21:07:03] dbg: [net] Initializing UDP listeners
[2023-03-30 21:07:03] dbg: [net] Initializing UDP listeners
[2023-03-30 21:07:03] dbg: [net] Listening on 0.0.0.0:3979 (IPv4)
[2023-03-30 21:07:03] dbg: [net] Listening on 0.0.0.0:3979 (IPv4)
[2023-03-30 21:07:03] dbg: [net] Network revision name: 13.0
[2023-03-30 21:07:03] โ€Ž*** Game still paused (manual, number of players)
[2023-03-30 21:07:04] dbg: [net] Connected to coordinator.openttd.org:3976
[2023-03-30 21:07:04] dbg: [net] Connected to stun.openttd.org:3975
[2023-03-30 21:07:07] dbg: [net] ----------------------------------------
[2023-03-30 21:07:07] dbg: [net] Your server is now registered with the Game Coordinator:
[2023-03-30 21:07:07] dbg: [net]   Game type:       Invite only
[2023-03-30 21:07:07] dbg: [net]   Connection type: Behind NAT
[2023-03-30 21:07:07] dbg: [net]   Invite code:     xxxxx
[2023-03-30 21:07:07] dbg: [net] ----------------------------------------

I suspect that changing line 7 in "entrypoint.sh" would resolve the issue:

_if [ ! -f /config/.config/openttd.cfg ]; then_

Supported Architectures

I went to run the container on a Pi 4, and realized that there is no ARM64 image for this container. Is there any plan to add support for this in the future?

Docker file for X11-forwarding

Hi,

As I understand this is only for the server mode?

How would you modify this to be able to play in Docker? I already have set up XQuartz, so I just need to get the build to also include everything that I need

Cheers

Config generation in entrypoint might be broken

when launching a new container I get no base config, the server just launches without it, testing the command to generate it with docker exec gives me this

openttd@30061a15533a:~$ timeout -t 3 openttd -D
timeout: invalid option -- 't'
Try 'timeout --help' for more information

/config/save/ not found...

Hi guys,

I'm really struggling to get this image to load a saved game. I'm fairly new to Docker so i'm probably doing something stupid. I'd really appreciate some help!

I'm running:
docker run -d --name openttd -p 3979:3979/tcp -p 3979:3979/udp -e savegame=autosave -v ~/.openttd:/config:rw redditopenttd/openttd:latest

Without the argument e loadgame=true the logs show:

loadgame not set - starting new game

...and then proceeds to generate a new map.

With -e loadgame=true in the command, if I look at the docker logs of the container, i'm just hitting the error:

/config/save/ not found...

If I remove both -e arguments, the container loads up and the openttd.cfg file that's being mounted is working as expected; the server is named correctly, with all the correct configuration and map size etc. I just can't find autosaves or explicit saved game files (e.g. -e savegame=mysavedgame.sav)

Things I've tried:

  1. I've ensured there is a /save/ folder within ~/.openttd folder that contains the .sav files.
  2. I've chown'd (root:root and robin:robin) and chmoded the hell out of everything in case it was permissions and ownership related.
  3. The .openttd folder that i'm mounting lives in my /home/robin/ user folder, and i've tried running docker as robin with sudo and as root.
  4. Explicitly loading just the openttd.cfg file and the save directory as two separate -v arguments as described in luaduck's latest readme commits.

Cheers,
Robin

Config folder filled with game files

my docker run command is:
docker run -d --name openttd --restart=always -p 3979:3979/tcp -p 3979:3979/udp -e savegame=autosave -v ~/.openttd:/config:rw redditopenttd/openttd:latest

It runs fine, but instead of ~/.openttd having just a config file in it, it contains the base game files. screenshot: https://i.imgur.com/dyXPnrb.png

Is this intended? I can't find openttd.cfg anywhere, and it doesn't seem like this is intended.

Container doesn't upgrade to newest version

My Container doesn't want to upgrade to the latest (13.3) Version of OpenTTD and instead stays at 13.1.
It doesn't matter if I use the latest/stable or testing tag.
I thought it would upgrade at least in some 24h windows.

UID and GID Specification

Good afternoon, thanks for the work on this container. Been running it without persistence for a bit and it's worked great. Recently I have been working to get it setup to utilize the config directory so it can resume from autosave however I am having trouble configuring it to run as a proper user that has permissions to the folder.

I am running Docker from my Synology NAS and have many other containers I run which generally take PUID and GUID or UID and GID property that can be set as an environment variables to specify the user. Looking through the documentation and code it doesn't appear this container supports that.

Any chance that could be added?

Config File Version

Hi the server works so far, but I think it got the wrong version.
If I look into the generated config file I see the following under the VERSION section

[version]
version_string = 1.10.1
version_number = 1A086D64

This indicated a version from 2020 I assume, is this intended?
Greetings

My Files Land in wrong Place. .local/share/

The game search in

No config file found: generating one

ls: cannot access '/config/save/autosave/': No such file or directory

/config/save/autosave/ not found...

but the files and the save dictory lands in .local/share/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.