Add healthcheck to container

This commit is contained in:
2024-09-12 14:05:03 +02:00
parent 8dd9566bf1
commit 5fdbf8c76d
2 changed files with 6 additions and 3 deletions
+1 -2
View File
@@ -40,5 +40,4 @@ CMD /bin/sh -c ' \
echo Fixing ownership of minecraft directory... && \
chown -R mcuser:mcgroup /minecraft && \
echo Starting minecraft server as mcuser && \
su - mcuser -c "cd /minecraft/ && java -Xmx2G -Xms512M -jar /minecraft/paper.jar nogui" && \
sleep 1727313' > /minecraft/logs/stdout.log 2> /minecraft/logs/stderr.log
su - mcuser -c "cd /minecraft/ && java -Xmx2G -Xms512M -jar /minecraft/paper.jar nogui"'
+5 -1
View File
@@ -18,7 +18,11 @@ if ($container) {
-v "$(pwd)/plugins:/minecraft/plugins" `
-v "$(pwd)/logs:/minecraft/logs" `
--restart unless-stopped `
minecraft-paper
--health-cmd "nc -z localhost 25565 || exit 99" `
--health-interval 30s `
--health-timeout 10s `
--health-retries 1 `
$imageName
Write-Host "Starting the container '$containerName'..."
docker start $containerName