ElementZero icon indicating copy to clipboard operation
ElementZero copied to clipboard

docker doesnt properly shutdown server - possible world corruption

Open madeofstown opened this issue 5 years ago • 2 comments

When using the commands docker stop <containerid> or docker restart <containerid>, docker fails to gracefully stop the server and thus invites corruption of the world files.

You can check this yourself by not auto-removing the container when it stops ( no --rm in your docker start script). Then stop the server with docker stop <containerid> Then type: docker inspect -f '{{.State.ExitCode}}' <containerid> It will return: 137

In fact, an exit status greater than 128 is typically a sign that the process was terminated as a result of an unhandled signal. 137 = 128 + 9 -- meaning that the process was terminated as a result of signal number 9 (SIGKILL). --https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/

madeofstown avatar Jul 13 '20 02:07 madeofstown

Thanks for the info. I've added this to the wiki as well.

Weissnix4711 avatar Jul 13 '20 10:07 Weissnix4711

If you want to automate server restarts then you should run your docker container in a screen (using the screen command).

Then you can modify this restart script for your needs. screen -S <screenID> -X stuff 'stop'$(echo -ne '\015') && sleep 10; bash /path/to/<startscript.sh>

Add this to the wiki please

madeofstown avatar Jul 13 '20 12:07 madeofstown