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 your kid to build up his own Minecraft Server flawlessly
- No deep knowledge of 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 customizable
In this article, I will show you how you can set up Minecraft running inside Jetson Nano using Docker in just 2 minutes.
Hardware
- NVIDIA Jetson Nano
- SD Card
- 5V 4A Power Adapter
- HDMI Cable
- 16GB/64GB SD card
Software
- Jetson SD card image from https://developer.nvidia.com/embedded/downloads
- Etcher software installed on your system
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.
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)
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
....
[This blog was originally published under https://collabnix.com/running-minecraft-server-in-2-minutes-using-docker/]
Top comments (0)