Minecraft server with Podman
I’m running a Minecraft server in my LAN for the family to play in the same world.
It should be OK running it from the
jar file, but I decided to use podman because:
- It adds security and “peace of mind” because I’m running it in my personal desktop PC.
- I wanted to try
podmanas root-less alternative to Docker.
Install in Debian
sudo apt install podman crun slirp4netns uidmap fuse-overlayfs
- Apparently you can also use the
uidmapare “recommended packages”, but they are needed in this case.
fuse-overlayfsis also a “recommended package”, but I have encountered issues with the default
vfsstorage driver (e.g. stuck on
Note: if you started using
vfs –like I did–, you may need to stop your containers and, keeping safe your volumes, remove
~/.local/share/containers/storage before installing
fuse-overlayfs. Then pull the images again and it should be using
overlay. It is unfortunate that
podman uses the best available driver by default, independently of your existing storage, and they aren’t compatible.
podman on Debian doesn’t come with any registries configured.
mkdir -p $HOME/.config/containers echo 'unqualified-search-registries=["docker.io", "quay.io"]' > $HOME/.config/containers/registries.conf
From Podman page in Debian’s wiki; although having only
docker.io is probably enough.
I don’t want to run the container all the time, so this is convenient to start it when needed.
#!/bin/bash # start the minecraft server NAME=minecraft-server VOLUME=$HOME/pods/minecraft/data podman ps | grep $NAME && exit TAG=java17-alpine podman run -d -it --rm -p 25565:25565 -e EULA=TRUE \ --name $NAME \ -v $VOLUME:/data itzg/minecraft-server:$TAG
This expects some directories in place, run:
mkdir -p $HOME/pods/minecraft/data
Tip: save as
start script in
Setup the server
- Start the container and check the logs until it has finished.
- Stop it and edit
server.propertieschanging anything you want.
- Start the server again.
I’m using itzg/minecraft-server, and these are the docs.
The clients can connect using the IP of the machine running the server (in my case, in my LAN).
- Start the server: see
- Stop the server:
podman stop minecraft-server
- Check the logs:
podman logs -f minecraft-server
Useful console commands
podman exec minecraft-server rcon-cli '/gamerule disableRaids true'
podman exec minecraft-server rcon-cli '/summon minecraft:chicken x y z'
(get the x y z coordinates from a player by pressing F3 on their client; ensure the player is in an appropriate place!)