Hosting a Minecraft Server using Podman
I have been wanting to test out the ability to host some things from home for friends and family. I recently purchased a Ubiquity Cloud Gateway Max, U7 Pro AP, and USW Ultra 60W. With a firewall in place and more control over my network, I decided to take this refurbished Dell OptiPlex 9020 (i7 CPU, 32gb DDR3, 1TB SSD) and repurpose it to a Debian 12 server. I looked into a few solutions on efficient hosting, and thought about Docker. While doing some research I found Podman. Its pretty much the same as Docker, but has some really cool differences. Both run containers, but Podman is lighter and runs daemonless as well as rootless. This makes Podman much more light on resources and more secure. I looked around at some different images and landed on one that is current, up to date for Minecraft with mods if you choose. You can find the documentation for it here, and the image here.
Installing podman on Debian was pretty straight forward, and can be done using brew or just apt. The homebrew package manager is nice because it will grab any dependencies you need while installing. That being said the podman documentation does not recommend installing podman via brew, but it's nice to have installed for other packages.
sudo apt-get install podmanInstalling this on Raspberry Pi OS would be the same as it runs on the standard Debian repositories.
Next you will want to create registries so you can use podman search or podman pull to create containers
mkdir -p $HOME/.config/containers
echo 'unqualified-search-registries=["docker.io", "quay.io"]' > $HOME/.config/containers/registries.confThese commands are pulled straight from the Podman page in Debian's Wiki
Next I created some directories in order to organize my containers data
mkdir pods
cd pods
mkdir minecraft
cd minecraft
mkdir dataNext I created a docker-compose.yml text file with nano
nano docker-compose.ymlMy layout is as follows
version: "3.8"
services:
mc:
image: itzg/minecraft-server
tty: true
stdin_open: true
ports:
- "25565:25565"
environment:
EULA: "TRUE"
MEMORY: 7G
MOTD: "Our Minecraft Server"
WHITELIST: "PlayerNames"
volumes:
# attach the relative directory 'data' to the container's /data path
- ./data:/data
To get an idea of what these environment variables do you can refer to the above MEMORY: defines the amount of RAM allocated to the server
MOTD: Sets the Message Of The Day
WHITELIST: You create a list of allowed players that can connect to the server (This isn't needed for local hosting)
You can adjust/add these variables as needed for your configuration. This image has quite a few you can check out here.(once you run it once you can just stop it and edit the server.properties like a regular server as well, then start it back up after)
In order to use the command below you will need the podman compose plugin. You can install it using pip3 or brew.(This is when Brew is nice to have installed)
podman compose up -dOnce you run this your container should start up as long as you have all the directories in place and you should be able to connect to it locally on your network. If you are trying to do this to play over the internet make sure you have a whitelist in place and you will need to forward your ports. If you don't have a static IP and want to host to the internet services like NoIP are really handy. Make sure you research network security some before opening your network to the public.
Overall I had a lot of fun setting this up, and learning more about containerization. I currently have a ProjectZomboid server running in tandem with the Minecraft server. If you want to explore some options on what you might be able to run in containers you can explore DockerHub and Quay. Hope you have found this helpful, and until next time.
Happy Hacking.