A hopefully reasonable Terraria server instance in a Docker Container
It's an instance of the Terraria standalone server in a Docker container for linux.
Game servers are ephemeral enough to be well suited to the purpose. Also I have a big swarm where I can just shuffle game servers around.
Nothing really, it's just yet another container image made by some asshole on the internet who thought he knew better.
It runs under a host provided uid, uses an intermediate build image as to not pollute the final image with bloated setup dependencies, and keeps all its config and state files on a single volume, which is what I usually want from a container image.
If you want, but I can't guarantee the absence of russian backdoors, as with every Docker image. Feel free to fork or audit this, however.
Not at this time, but eventually yes. I'm still considering whether to make hybrid images or separate variants.
For the impatient, here is a replacement for documentation.
- Put your current uid in the
docker-compose.yml
file - Put the full path to the
testvolume
directory in thedocker-compose.yml
file $ docker-compose up --build
- See on screen instructions and files under the
testvolume
directory
- Create a user and group to use as a service account on the docker host, note the uid and gid. It can be a system user if you'd like (ex: 999:999)
- Create a directory tree somewhere on the host to hold the game data and configuration, e.g:
mkdir -p /srv/terraria
- (optional) Place your existing
serverconfig.txt
file in the root of the directory, and your.wld
world files underworlds/
. - Edit the server configuration file to match the new paths. The directory on the host is mounted under
/data
, so in the above example, an example path would be/data/worlds/world1.wld
. - Change ownership and permissions on this directory tree on the host to match the service account and group you've created in step 1
- Run the container with
--user 999:999
where the uid and gid are the ones of the service account and group, and use a volume mount for the data directory on/data
On first run, the container will generate an example configuration which you can edit and rename to serverconfig.txt
.
Make sure the paths (all starting with /data
) are correct, especially the world path and world dir.