Deploying a Minecraft Docker Server to the Cloud

22 January, 2023

Deploying a Minecraft Docker Server to the Cloud

One of the most common examples of Docker that people have used over the years is quickly setting up and running a Minecraft server. This is a great example of Docker's power and has a very practical application!

Recently, I wanted to set-up a server but I wanted it to be persistent. I had just given away my last raspberry pi so I needed to find a way to do this. I decided to give Azure a try using the $200 credits I received in my first month.

To find out if there were any Docker Images for Minecraft servers that I could use, I first went to Docker Hub.

I liked the look and feel of minecraft-server repo so I clicked through to take a look at it and link to the Github repo.

I decided to start by running it locally on my machine using the Docker Run command "simple get started".

The Docker Desktop Dashboard shows me that I have the container running. I can also check the logs to ensure everything is in order.

I can connect to my Minecraft server using my local host and my open port:

You can then deploy it in Azure to get your basic server up and running in the cloud.

I can log in to Azure using the Docker ACI integration:

Once I log in, I can create a contextual that will allow me to deploy containers to an Azure Resource Group (this allows you to create a new azure resources group or use an existing one).

This new context can be used by

I will now attempt to deploy minecraft server using exactly the same command that I used locally.

I'll list my azure containers and the public IP that was provided for my Minecraft server.

However, I can see that the ACI container logs indicate that the server is stuck in initialization and cannot be connected to from Minecraft.

The logs show that the Minecraft server has 1G of memory. This is the default memory that ACI allocates to the entire container. Let's increase the ACI limit by using the -memory option.

ACI's server logs now show that the server was properly initialized. To get the public IP of my container I can run $ docker-ps again. Then, I can connect to it via Minecraft and play!

This is great. But now I want to know how to ensure my data persists and decrease the time it takes to run the server.

I will create a Compose File to document the command I am using. Next, I will add a volume that I can mount my data.

Our command as before has our image name moved into the image section, our ports -p into the ports and our EULA acceptance added to the environment variables. We also make sure that the server container has enough memory for starting.

It is now much easier to start this locally:

To deploy to ACI, I still use the ACI context that I created previously:

Compose allows you to include multiple containers. Here we only have the "minecraft", one. The progress display shows the containers (here, the "minecraft") line. And listing the containers shows the name of the application and the container name mc2_minecraft:

Next, we will add a volume that contains our Minecraft data. This volume can also contain other maps. To do this, I need to know which folder contains the Minecraft data in the Docker Image. If I inspect the Docker Dashboard, I can see that it's the /Data directory.

To add this back to my command line, I would need to modify my command to say:

You can add this to my Compose file:

Now, when I do a docker compile up and return to inspect, I can see that the /data folder inside the container has been mounted to my local folder. Navigating to the local folder, I can view all Minecraft data.

Let's now create an Azure File share and deploy our application so that we can mount /data in the Azure shared persistent directory.

First, I must create an Azure storage account. You can either use the Azure "az", command line, or the Azure portal. I prefer the portal.

I will need to select the storage account name, and then the resource group I want to attach to it. I will let the other options default to this example.

Once the "minecraftdocker storage account" is created, I will create a file sharing that will contain all Minecraft files.

I only need to give a name to this file share and a size limit; let's call minecraft-volume.

Next, I'll edit my compose file to change the volume specification to point at this Azure File Share.

It is possible that the syntax used to specify ACI volumes in Compose file files will change in the future.

I can then redeploy the compose application to ACI using the same command line as before.

It's possible to check it using the Azure File Share. Just select the minecraft-volume Share from the Azure portal.

Security Note - In this Azure File Share web UI screen shot above, you can see that the Minecraft server created a default value and whitelist.json empty array. contains the whitelist disabled default ("white-list = False") and a default RCON password that can be used to remote administer the server. In our current setup, the RCON ports have not been exposed so rcon is not possible. If you wish to use RCON, you can expose port 25575 and port 25565 in your compose file. However, make sure to change the password in before proceeding.

See for more details on Mineraft server properties.

Azure File Share allows you to download the file, modify it (e.g. change RCON password, set white-list property to true), and then upload the file back. The same applies to the whitelist.json files.
You can restart the Minecraft server by simply re-issuing the compose up command.

$ docker --context acitest compose --project-name minecraft up

It will redeploy your container but reuse any data in the volume so it can load the and whitelist.json files that you have uploaded to the Azure File Share.

If you don't belong to the white list and you try to connect your Minecraft app, you will see:

Download the latest Edge version Docker Desktop to get started with your Minecraft server. Docker Hub has the Minecraft image. You can also download Docker Desktop Edge to get started creating your own content using Dockers Official images. You can also create content similar to this by creating a Docker account.