beardedio/terraria

System.NullReferenceException when loading a world

NoeelMoeskops opened this issue · 8 comments

1.4.0.2 server returns a "System.NullReferenceException" exception when loading a world.

server log

I got that issue as well. One thing to note is that I couldn't even get vanilla terraria to run. I think it may just be an issue with terraria itself.

Same here and I couldn't find that error on Google or the official Terraria forum. I have no idea what's causing this.

ss89 commented

Have you guys started the image interactive and with a tty assigned? "docker run -it ..."?

Same issue on my side, but only if I try to run the container as part of a docker-compose.yml file like the following one:

version: '3'
services:
  terraria:
    image: beardedio/terraria:vanilla-1.4.0.2
    ports:
      - '7777:7777'
    restart: always
    environment:
      - world=worldfile.wld
    volumes:
      - ./config:/config

If I start the server using docker run, it runs just fine.

sudo docker run -it -p 7777:7777 -v /path/to/config:/config -e world=worldfile.wld --name=terraria beardedio/terraria:vanilla-1.4.0.2

You are right. The problem is not occurring with docker run, only with docker-compose. So what's the difference?

I managed to solve/circumvent the problem now with the following docker-compose.yml. Notice the additional line at the bottom. As far as I understand, the Terraria server requires an open shell, which is present when running docker run -it. The additional line provide this shell to the docker container in docker-compose.

version: '3'

services:
  terraria:
    image: beardedio/terraria:vanilla-1.4.0.2
    ports:
      - '7777:7777'
    restart: always
    environment:
      - world=worldfile.wld
    volumes:
      - ./config:/config
    tty: true

I hope, this also works for the others.

It looks like this issue was explained. If adding tty mode to the command doesnt fix it please let me know and I will look into it more.

For those who wants to run it silently in background (like a server is supposed to run)

docker-compose -f docker-compose.yml up >/dev/null 2>&1 &

Not ideal but it works.
Cheers