Skip to content

A dockerized Terraria 1.4.5> server that has auto-updating functionality.

Notifications You must be signed in to change notification settings

coffeegrind123/terraria-server-docker-1.4.5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraria Server

Dockerized Terraria dedicated server with automatic updates.

Features

  • Automatic Updates - Enumerates and installs latest Terraria server on startup, with hourly update checks
  • Remote Commands - Execute server commands via docker exec eq. docker exec cmd playing to list online players
  • World Persistence - World data stored in local volume

Quick Start

# Clone repository
git clone https://github.com/coffeegrind123/terraria-server-docker-1.4.5.git
cd terraria-server-docker-1.4.5

# Start server
docker-compose up -d

# View logs
docker-compose logs -f

Configuration

Edit docker-compose.yml:

terraria:
  environment:
    - TERRARIA_MAXPLAYERS=8
    - TERRARIA_AUTOCREATE=3        # 1=Small, 2=Medium, 3=Large
    - TERRARIA_DIFFICULTY=0         # 0=Normal, 1=Expert, 2=Master, 3=Journey
    - TERRARIA_PASSWORD=           # Leave empty for no password
    - TERRARIA_WORLDNAME=world     # World name (creates or loads this world)
    - AUTO_UPDATE_ENABLED=1        # Enable automatic updates

Multiple Worlds

The TERRARIA_WORLDNAME variable controls which world to load or create:

  • New world name: Creates a new world with that name
  • Existing world name: Loads the existing world
  • World files are stored in ./world/{WORLDNAME}.wld

Example configurations:

# Creative world
- TERRARIA_WORLDNAME=creative

# Hardcore world
- TERRARIA_WORLDNAME=hardcore

# Custom world path
- TERRARIA_WORLD=/custom/path/myworld.wld

Remote Commands

Execute server commands from your host:

# Show online players
docker exec terraria-server cmd playing

# Save the world
docker exec terraria-server cmd save

# Show help
docker exec terraria-server cmd help

Auto-Update System

When enabled, the container:

  1. Checks for updates hourly by enumerating available versions
  2. Warns players 2 minutes in advance and also the final 30 seconds before restart
  3. Saves world and gracefully shuts down
  4. Downloads and installs update
  5. Restarts server with new version

Update announcements show version numbers: Update available: v1450 -> v1452

World Management

World files persist in ./world/ directory. Each world is named according to TERRARIA_WORLDNAME.

Backup world:

tar czf terraria-backup-$(date +%Y%m%d-%H%M).tar.gz ./world

Restore world:

docker-compose down
tar xzf terraria-backup-YYYYMMDD-HHMM.tar.gz
docker-compose up -d

Switch to different world:

# Edit docker-compose.yml
- TERRARIA_WORLDNAME=adventure

# Restart
docker-compose restart

Force new world:

docker-compose down
rm ./world/world.wld
docker-compose up -d

OR change TERRARIA_WORLDNAME:

- TERRARIA_WORLDNAME=namehere

Commands

# Start
docker-compose up -d

# View logs
docker-compose logs -f terraria

# Stop
docker-compose down

# Restart
docker-compose restart

# Force a clean rebuild and restart
docker compose build --no-cache; docker compose up -d

Server Config (Optional)

For advanced configuration, mount a custom config file:

terraria:
  volumes:
    - ./config.json:/terraria/TerrariaServer/Linux/serverconfig.txt:ro

Example config.json:

{
  "ServerPort": 7777,
  "MaxPlayers": 8,
  "WorldName": "world",
  "Password": "",
  "Motd": "Welcome to my Terraria Server!"
}

FRP Tunneling Support

To enable FRP tunneling for remote access behind NAT/firewalls:

cp -f extras/frp.docker-compose.yml docker-compose.yml
cp -f extras/Dockerfile.frp .

See extras/README.md for detailed setup instructions.

Links

About

A dockerized Terraria 1.4.5> server that has auto-updating functionality.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages