Didstopia / rust-server

Provides a dedicated linux server for Rust (the game) running inside a Docker container.
MIT License
243 stars 105 forks source link

Restarting container using scripts or SystemD causes bootloop but works fine issuing commands manually #90

Closed ejpo closed 3 years ago

ejpo commented 3 years ago

Describe the bug Whenever I try to restart the rust-server container using systemd or using cron jobs and a batch file, the container just inifinitely boot loops.

To Reproduce Steps to reproduce the behavior:

  1. Create a container using the following command: docker run --name rust-server-auto -d -p 28015:28015 -p 28015:28015/udp -p 28016:28016 -p 8080:8080 -p 28083:28083 -v /opt/rust/server:/steamcmd/rust --env-file /opt/rust/rust.env didstopia/rust-server
  2. Create a script to restart the container with the following contents:

    !/bin/bash

    docker exec rust-server-auto rcon say Server is saving before restarting docker exec rust-server-auto rcon server.save docker exec rust-server-auto rcon say Server is now going down for daily restart docker stop rust-server-auto docker rm -f rust-server-auto docker run --name rust-server-auto -d -p 28015:28015 -p 28015:28015/udp -p 28016:28016 -p 8080:8080 -p 28083:28083 -v /opt/rust/server:/steamcmd/rust --env-file /opt/rust/rust.env didstopia/rust-server

  3. Create a cron job to run this command as the user that created the container
  4. Watch the containerfail to restart at the specified time
  5. Run the commands manually at 4AM and watch the container magically boot up because you entered the command in an interactive shell instead (Sorry this has been driving me a little insane!)

Expected behaviour I expect that regardless of running the commands interactively or through a SystemD unit file or a script run by a cronjob that the behaviour is identical - the server restarts cleanly and does not boot loop

Screenshots None applicable, not even any useful log output. The container never gets as far as steam trying to update rust however, it just restarts to the Didstopia ascii logo

Environment (please complete the following information):

Additional context I am not the most proficient docker admin, so I fully expect that this is an issue of my own creation. I understand that you may not be able to help me, but really any help in trying to resolve/troubleshoot this would be greatly appreciated!

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.