April 25, 2021

Docker Minecraft Servers Java & Bedrock

Bedrock Edition

https://hub.docker.com/r/itzg/minecraft-bedrock-server 

docker run -d -it --name minecraft-sa -e EULA=TRUE -p 192.168.1.68:19132:19132/udp -v sa-volume:/data itzg/minecraft-bedrock-server

Java Edition

https://github.com/itzg/docker-minecraft-server/blob/master/README.md

docker run -d -it --name minecraft-jv -e EULA=TRUE -p 192.168.1.68:25565:25565 -v mj-volume:/data itzg/minecraft-server

Docker Commands

Access Console

  • docker attach minecraft-jv
  • - Control-p Control-q to detach

Check network ports in use in container

    • docker inspect -f '{{.State.Pid}}' minecraft-jv
    • nsenter -t 5549 -n netstat

Servers

  • Aidan - Java - 192.168.1.68:25565
  • Aidan - Bedrock - Survival - 192.168.1.68:19132


Backup Script

# Stop the Minecraft Server nicely
echo 'stop' | socat EXEC:"docker attach minecraft-sa",pty STDIN
# Backup the minecraft data
/media/nas-backup/scripts/backup-folder -n minecraft-sa-weekly -f "/var/snap/docker/common/var-lib-docker/volumes/sa-volume"
# Restart the container
docker start minecraft-sa

No comments: