A heavily refactored fork of the original image focused on security and flexibility. The container runs the server as a non-root user, supports configurable PUID/PGID, downloads server files at runtime, and uses a custom-maintained ARM64 base image instead of the original discontinued one.
Follow this docker-compose.yml example and check environment variables below for more information.
services:
terraria-server:
image: diyagi/terraria-server-docker:latest
container_name: terraria-server
restart: unless-stopped
stdin_open: true
tty: true
ports:
- 7777:7777
volumes:
# Server config can be mounted and edited to include journey mode permissions
#- ./server-config.conf:/home/terraria/server-files/server-config.conf
- ./worlds:/home/terraria/worlds
environment:
PUID: 1000
PGID: 1000
PORT: 7777
VERSION: "latest"
WORLD: "My Little Test World"
AUTOCREATE: 2
DIFFICULTY: 2
MAXPLAYERS: 4
PASSWORD: ""
MOTD: "BEAR!"
SECURE: 0
NPCSTREAM: 0
| Variable | Type/Default | Description |
|---|---|---|
PUID | 1000 | UID used by the container to run the server as. |
PGID | 1000 | GID used by the container to run the server as. |
VERSION | "latest" | Target Terraria server version to be downloaded and used, accepts SemVer standard (ex: 1.4.5.5). |
PORT | 7777 | Terraria server port. |
MAXPLAYERS | 16 | Max players that can join the server at same time |
MOTD | "Welcome!" | Message of the day, message thats shown in chat when a player joins the game. |
PASSWORD | "" | Server password. |
WORLD | "" | World Name. |
AUTOCREATE | 1 | Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large). |
BANLIST | "banlist.txt" | The location of the banlist. Defaults to "banlist.txt" in the working directory. |
SECURE | 1 | Adds additional cheat protection. |
UPNP | 0 | Automatically forward ports with uPNP. |
DIFFICULTY | 1 | Sets world difficulty when using -autocreate. Options: 0(normal), 1(expert), 2(master), 3(journey) |
NPCSTREAM | 0 | Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off. |
LANGUAGE | "en-US" | Sets the server language from its language code. Available codes: en-US-English; de-DE-German; it-IT-Italian; fr-FR-French; es-ES-Spanish; ru-RU-Russian; zh-Hans-Chinese; pt-BR-Portuguese; pl-PL-Polish; |
PRIORITY | 1 | Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle |
SEED | "" | Sets the world seed when using autocreate. |
Content type
Image
Digest
sha256:3420a1260…
Size
45.4 MB
Last updated
6 months ago
docker pull diyagi/terraria-server-docker