Hey everyone,
I'm trying to set up a Minecraft server using the itzg/docker-minecraft-server image on my Ubuntu Server, but I'm having some trouble. Every time I reboot my system, the Docker container seems to disappear, and I don't want to lose my progress either.
So I have two main questions:
1. How can I make sure the Docker container restarts automatically when I reboot the server?
2. What do I need to do to ensure that my world saves properly so that I can continue where I left off after a reboot?
I'm still a bit new to working with Ubuntu Server, even though I come from an IT background, so I'd really appreciate any guidance you can offer! Thanks!
1 Answer
To get your container to restart automatically, you can use the `--restart` flag in your Docker command. Setting it to `always` will ensure your container runs whenever your server boots up.
For saving your game world and making sure it persists between reboots, look into creating a Docker volume to store your Minecraft data. This way, your worlds will survive even if the container goes down.
Got it! So if my original command is `docker run -d -it -p 25565:25565 -e EULA=TRUE itzg/minecraft-server`, would I add the restart policy like this: `docker run -d -it --restart always -p 25565:25565 -e EULA=TRUE itzg/minecraft-server`? Just checking!