-2

i am trying to setup and run a docker image that runs a game server.

My docker command looks like this:

docker run --name 7dtd -d -t \
        -p 26900-26905:26900-26905/tcp \
        -p 26900-26905:26900-26905/udp \
        -e SEVEN_DAYS_TO_DIE_UPDATE_CHECKING="1" \
        -e SEVEN_DAYS_TO_DIE_CONFIG_FILE="/home/7dtd/server/serverconfig.xml" \
        -e SEVEN_DAYS_TO_DIE_BRANCH="latest_experimental" \
        --restart unless-stopped \
        -v /home/7dtd/server:/steamcmd/7dtd \
        -v /home/7dtd/data:/root/.local/share/7DaysToDie \
        didstopia/7dtd-server```

I keep recieving a error when this image starts by saing that it cant find the config file from the give path.

I changed the permission of that file and location to be read/writable for everyone but it still does not fix it.

Is it because the docker image cannot access my file system from outside its own container?

If so, how can i have this docker image access files/folders from outside its containter?

Here is the error output:

2021-10-06T16:59:53 0.251 INF Command line arguments: /steamcmd/7dtd/7DaysToDieServer.x86_64 -quit -batchmode -nographics -dedicated -configfile=/home/7dtd/server/serverconfigreal.xml
2021-10-06T16:59:53 0.263 ERR ====================================================================================================
2021-10-06T16:59:53 0.263 ERR Specified configfile not found: /home/7dtd/server/serverconfigreal.xml
2021-10-06T16:59:53 0.263 ERR ====================================================================================================

I am able to execute nano /home/7ttd/server/serverconfigreal.xml and see the file and its contents.

I am not sure what the problem is

This is the docker image in question: https://github.com/Didstopia/7dtd-server

Jono
  • 17,341
  • 48
  • 135
  • 217
  • 1
    I would assume you need to pass the file location within the docker container, not on your system. Looking at the folders that are mounted, that would be `/steamcmd/7dtd/serverconfig.xml`. – Daniel Lenz Oct 07 '21 at 13:13

1 Answers1

2

You have shared the config file with: -v /home/7dtd/server:/steamcmd/7dtd this means that the files from your host's /home/7dtd/server will be mapped to the container's /steamcmd/7dtd.

So you need to specify the config file path from the container's prospective: -e SEVEN_DAYS_TO_DIE_CONFIG_FILE="/steamcmd/7dtd/serverconfig.xml"

Matteo Zanoni
  • 3,429
  • 9
  • 27
  • How do I set it so the container loads the configuration file from my host machine? – Jono Oct 07 '21 at 13:40
  • This way the config file will be loaded from your host machine. Just first mirrored to the container's file system and then loaded from there. But the result is exactly what you need: the container will read the file on your host machine – Matteo Zanoni Oct 07 '21 at 14:06