thmhoag / arkserver

Docker image for a dedicated ARK Server with ArkManager.
MIT License
121 stars 43 forks source link

Container exits after first crontab run #29

Closed raphaelliskor-web closed 3 years ago

raphaelliskor-web commented 3 years ago

Image Setup Details

Description of Issue

I pulled the latest image yesterday and used it to setup an Ark-Server. To my suprise: After the first cron run of arkmanager restart --warn --saveworld the container shutdown. Its probably because the $arkmanpid in the run.sh script is not available anymore. I can reproduce the issue with a simple arkmanager restart command inside the container.

Additional Information

Suggestion for a quick workaround: Put an endless loop at the end of the run.sh script. Or do it like suggested in https://stackoverflow.com/questions/25775266/how-to-keep-docker-container-running-after-starting-services.

thmhoag commented 3 years ago

Hi @raphaelliskor-web. The behavior you're describing is actually intentional. The goal is to keep the lifecycle of the container tied to the lifecycle of the dedicated server. This is pretty standard for "normal" Docker images (web servers, Kubernetes services, etc) but a little strange here because we are forcing automatic restarts from inside the container itself. This makes it a little easier to use standard Docker tools for monitoring the server status (such as using docker ps to see server uptime). More importantly, it ensures that every start of the server is consistent regardless of whether or not it's a fresh container or just a daily restart.

To fix your issue though, I'd recommend adding the --restart=always flag to your docker run statement. This will configure Docker to restart the container automatically any time the server restarts, shuts down, or crashes. Something like this:

docker run -d \
    -v steam:/home/steam/Steam \ 
    -v ark:/ark \  
    -p 27015:27015 -p 27015:27015/udp \ 
    -p 7778:7778 -p 7778:7778/udp \  
    -p 7777:7777 -p 7777:7777/udp \ 
    thmhoag/arkserver
raphaelliskor-web commented 3 years ago

Hello @thmhoag, thanks for your reply and explanation.

If this is intended I would suggest either of two changes:

Exclude the cronjob generation for the restart from the run.sh script OR Give a hint about the --restart=always flag in the documentation of this image.

Just one more thing: It seems not all arkmanager commands are useful currently. Some of them need to restart the server, which currently closes the container, and resets the inner state.

thmhoag commented 3 years ago

Agreed, the docs are certainly lacking. They need a significant overhaul to include a lot of additional information.

As far as the commands go, are there any specific that you're attempting to use that are not working correctly due to the container restart?

raphaelliskor-web commented 3 years ago

As far as the commands go, are there any specific that you're attempting to use that are not working correctly due to the container restart?

Short answer: No.

Long answer: With the current workaround I dont have any. Generally all commands that implicitly or explicitly restarts the ark-server would shutdown the container. Because I run the server in crossplay mode I can't use any mods. Thats why I don't know if the "modding" commands do an implicit restart, e.g. arkmanager installmod.

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.