Home > Net >  Docker image ENV cant find a file?
Docker image ENV cant find a file?

Time:10-07

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

CodePudding user response:

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"

  • Related