One of the simplest examples that people have used over the years of demoing Docker is quickly standing up and running a Minecraft server. This shows the power of using Docker and has a pretty practical application!

Recently I wanted to set up a server but I wanted to persist one and as I have given away my last raspberry pi I needed to find a new way to do this. I decided that I would have a go at running this in Azure using the $200 free credits you get in your first month.

The first thing I decided to do was to check out the existing Docker Images for Minecraft servers to see if there were any that looked good to use, to do this I went to Docker Hub and searched for minecraft:

I liked the look of minecraft-server repo, so I clicked through to have a look at the image and link through to the Github repo.

To start I decide to just test out running this locally on my machine with the ‘simple get started’ Docker Run command:

$ docker run -d -p 25565:25565 --name mc -e EULA=TRUE

itzg/minecraft-server

In the Docker Desktop Dashboard, I can see I have the container running and check the server logs to make sure everything has been initialized properly:

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

From there, I can try to deploy this in Azure to just get my basic server running in the cloud.

With the Docker ACI integration, I can log into Azure using:

$ docker login azure

Once logged in, I can create a context that will let me deploy containers to an Azure resource group (this proposes to create a new azure resource group or use an existing one):

$ docker context create aci acicontext

Using only available subscription : My subscription (xxx)

? Select a resource group [Use arrows to move, type to filter]

> create a new resource group

gtardif (westeurope)

I can then use this new context :

$ docker context use acicontext

I will now try to deploy my minecraft server using the exact same command I ran previously locally :

$ docker run -d -p 25565:25565 --name mc -e EULA=TRUE itzg/minecraft-server

[+] Running 2/2

⠿ Group mc  Created                     4.6s

⠿ mc        Done                        36.4s

mc

Listing my azure containers, I’ll see the public IP that has been provided for my Minecraft server:

$ docker ps

CONTAINER ID        IMAGE                   COMMAND             STATUS         PORTS

mc                  itzg/minecraft-server                       Running        51.105.116.56:25565->25565/tcp

However, if I follow the logs of the ACI container, the server seems to be stuck in the initialization, and I cannot connect to it from Minecraft.

#engineering #products #aci #azure

Deploying a Minecraft Docker Server to the cloud
14.95 GEEK