To create a suitable Docker image, please navigate to the project directory and run:
docker build --platform linux/amd64 -t minecraft-server:latest .The image should be created. Now, to start the webserver, run:
go run .The web interface will be available at localhost:8080 The web interface allows to see the existing servers list or to select a version and create a server using PaperMC backend.
When creating a server, a Docker container is created and started. Every time the container starts, the Minecraft server starts. By default, a random port is chosen for this, so you will have to run this and get the port bound to the container:
docker psExample:
$ docker ps
IMAGE COMMAND CREATED STATUS PORTS NAMES
minecraft-server:latest "/usr/local/bin/star…" 6 seconds ago Up 5 seconds 0.0.0.0:32805->25565/tcp, [::]:32805->25565/tcp mc-e8869697-186a-4c89-b1cd-4325ade84629In my case, the port 32805 is the one you can connect to: <server_ip>:32805.
Note
For everyone else not from your LAN you would have to open these ports by enabling port forwarding in your router's settings.
Warning
This may lead to some security problems, so please do research beforehand and act at your own risk.
- Issue: Versions below 1.20.5 return error
- Workaround: Use version 1.20.5 or higher. Older versions require older java versions, which is complicated to implement at this point.
- Issue: I can't join the server
- Status: Please check which port Docker has bound the container to.
- Then in-game connect to <server ip>:<that port>.
- If didn't help, please execute
docker logs <container id>and read the server logs.