This article is also available in the following other languages / Dieser Beitrag ist auch in folgenden anderen Sprachen verfügbar: Deutsch

Terraria Server in Docker

2019-12-23 · christian · docker, games, linux

Yesterday I wanted to play Terraria again. To have the option for multiplayer later, I wanted to start directly on a dedicated server.

The following script starts the Terraria inside of a Docker Container without the need to create a Docker Image.

The Server binaries and world data are stored just in a folder of the host system. Both will be mounted into a vanilla Debian Buster Image.

docker stop terraria || true
docker rm terraria || true

chmod a+x /opt/docker-terraria/bin/TerrariaServer*

mkdir -p \
    /opt/docker-terraria/bin \

# - Download Dedicated Server from
#   (Link at the bottom of the page)
# - Extract the linux binaries to
#   /opt/docker-terraria/bin

docker run -it -d \
    --name terraria \
    -p 7777:7777 \
    -v /opt/docker-terraria/bin:/root/bin/terraria \
    -v /opt/docker-terraria/world:/root/.local/share/Terraria \
    --workdir /root/bin/terraria \
    --entrypoint ./TerrariaServer.bin.x86_64 \
    debian:buster-slim \
        -players 50 \
        -motd "LadL 2022" \
        -port 7777 \
        -autocreate 3 \
        -worldname myworld \
        -world /root/.local/share/Terraria/Worlds/myworld.wld

The admin console of the server can be opened with docker attach terraria. To close the console again, use the keyboard shortcut CTRL-p, CTRL-q.

When the docker host runs more (maybe critical) stuff, you may want to limit the ressources of the container with --memory and --cpus.

More BG by Carl Lender (CC BY 2.0) Imprint & Privacy
9d41264a 2023-12-28 19:26
Mastodon via Mastodon via