How to host Minecraft server in docker container?

How to host Minecraft server in docker container?

Table of contents

No heading

No headings in the article.

In this article I will show you how to host a Minecraft server in docker.

What is the purpose of a Minecraft server?

Minecraft multiplayer mode can be quite overwhelming if there are so many unwanted players. By hosting your own Minecraft server you can play with your friends and enjoy the multiplayer mode of the game.

Requirement -

OS - Ubuntu/CentOS

Docker

Internet connection

Clone my repository from GitHub.

git clone https://github.com/asabhi6776/minecraft_server.git 
 cd minecraft_server

Add the latest Minecraft server version and PaperMC build number to the env file.

    vim .env
    BUILD = "141"
    VERSION = "1.19.2"

You can find build no. here

In the end, start the container after you have completed these steps.

docker-compose up -d

It will automatically sync your volume with the container game directory after the container is started. Within your volume, edit the server.properties according to your requirements and restart the container.

In your game, you can now use the server's IP address and port and share it with your friends.

You can reach out to me on twitter, you can join my discord by clicking this link.

Thanks.