42,304 views

With over 126 million monthly users, 200 million games sold & 40 million MAU, Minecraft still remains one of the biggest games on the planet. It is an incredibly popular game which was created for the first time in the year 2009. Microsoft acquired Minecraft for $2.5-billion deal in early 2017 and ever since over 30 million copies of Minecraft has been sold for PC and Mac. There is a general perception that its player base skews more towards children. The simple graphics and LEGO-like design feed into this perception – but according to Microsoft, it’s simply not the case, and the average age of a Minecraft player is older than you might think.(24 years old)

Minecraft is educational

Yes, you heard it right. Minecraft is an educational game. It is unique in that it’s an unlimited world where kids can create literally anything they can imagine, but within the constraint that everything is made up of blocks that must fit within the 3D grid of the game.. One primary reason Minecraft is good for kids is the promotion of creativity, problem-solving, self-direction, and collaboration—all of which stand out as the less-tangible, non-academic benefits Minecraft provides. It is these life skills that will give kids the boost needed when they eventually work their way towards succeeding in college and future careers.

Why Minecraft inside Docker container?

  • It’s fun.
  • It allows my kid to build up his own Minecraft Server in just 2 minutes
  • No deep knowledge on Docker is required(for my kid). Just one single liner command and everything is all up and running
  • Can be run locally or hosted over the Cloud
  • Can be run on IoT boards like Jetson Nano & Raspberry Pi
  • Highly customisable

Under this article, I will show you how you can setup Minecraft running inside Jetson Nano using Docker in just 2 minutes.

Hardware

No alt text provided for this image
  • NVIDIA Jetson Nano
  • SD Card
  • 5V 4A Power Adapter
  • HDMI Cable
  • 16GB/64GB SD card

Software

1. Preparing Your Jetson board

  • Unzip the SD card image
  • Insert SD card into your system.
  • Bring up Etcher tool and select the target SD card to which you want to flash the image.
No alt text provided for this image

2. Verifying if it is shipped with Docker Binaries

ajeetraina@ajeetraina-desktop:~$ sudo docker version
[sudo] password for ajeetraina: 
Client:
 Version:           19.03.6
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        369ce74a3c
 Built:             Fri Feb 28 23:47:53 2020
 OS/Arch:           linux/arm64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.6
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       369ce74a3c
  Built:            Wed Feb 19 01:06:16 2020
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.3.3-0ubuntu1~18.04.2
  GitCommit:        
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:    

3. Running the Minecraft Server using Docker

sudo docker run -d -p 25565:25565 -e EULA=true -e ONLINE_MODE       =false -e DIFFICULTY=hard -e OPS=collabnix  -e MAX_PLAYERS=50 -e MOTD="welcome to Collabnix" -v /tmp/minecraft_data:/data --name mc itzg/minecraft-server:multiarch

where,

  • itzg/minecraft-server:multiarch is the right Docker image for ARM
  • /tmp/minecraft_data:/data is for persistence
  • MAX_PLAYERS is the maximum number of players you are allowing to participate
  • OPS is to add more “op” (aka adminstrator) users to your Minecraft server
  • DIFFICULTY is for the difficulty level (default: easy)
  • MOTD is for the message of the day

Almost done!

Open up your Minecraft client and look out for Server Name (which will be your host name) and use 25565 as port number (optional)

No alt text provided for this image

Key Takeaways:

  • You will need a dedicated Minecraft Docker Image(multiarch) to make it work on IoT devices like Raspberry Pi and Jetson Board
  • Minecraft is CPU intensive, hence even passing –gpus all option won’t help in improving the performance

Using Docker Compose

If you want to use Docker compose, you will need to install it first as Jetson Nano SD card image doesn’t come with it by default:

export DOCKER_COMPOSE_VERSION=1.27.4
sudo apt-get install libhdf5-dev
sudo apt-get install libssl-dev
sudo pip3 install docker-compose=="${DOCKER_COMPOSE_VERSION}"
apt install python3
apt install python3-pip
pip install docker-compose

Create a file called docker-compose.yml and add the below content:

version: '3.7'
services:
 minecraft:
   image: itzg/minecraft-server:multiarch
   ports:
     - "25565:25565"
   environment:
     EULA: "TRUE"
   deploy:
     resources:
       limits:
         memory: 1.5G

Now you should be able to run docker compose as shown below:


sudo docker-compose up
WARNING: Some services (minecraft) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use `docker stack deploy` to deploy to a swarm.
Creating network "pico_default" with the default driver
Creating pico_minecraft_1 ... done
Attaching to pico_minecraft_1
minecraft_1  | [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 2 1000 1000 4096 Aug  9 18:11 /data'
minecraft_1  | [init] Resolved version given LATEST into 1.16.3
minecraft_1  | [init] Resolving type given VANILLA
minecraft_1  | [init] Downloading minecraft_server.1.16.3.jar ...
minecraft_1  | [init] Creating server.properties in /data/server.properties
minecraft_1  | [init] Setting server-name to 'Dedicated Server' in /data/server.properties
minecraft_1  | [init] Skip setting server-ip
minecraft_1  | [init] Setting server-port to '25565' in /data/server.properties
....

Want to see it in action? Watch out my kid’s 5 Minute video on running Minecraft over DigitalOcean Cloud using Docker.

Clap


Ajeet Raina

My name is Ajeet Singh Raina and I am an author of this blogging site. I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I bagged 2 special awards last year(2019) : Firstly, “The Tip of Captain’s Hat Award” at Dockercon 2019, San Francisco and secondly, “2019 Docker Community Award“. I run Collabnix Community Slack with over 4700+ audience as well as Redis Community Slack with close to 500+ members. I have built popular GITHUB repositories like DockerLabs, KubeLabs, Kubetools, RedisPlanet Terraform etc. with the support of Collabnix Community. Currently working as Developer Relations Manager at Redis Labs where I help customers and community members adopt Redis. With over 11,000+ followers over LinkedIn & close to 4800+ twitter followers, I like sharing Docker and Kubernetes related content . You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)

0 Comments

Leave a Reply

Your e-mail address will not be published. Required fields are marked *