This guide will guide you through the configuration of a Minecraft Server using Docker, a technology that will hand almost all the server configuration.
The only thing that you need before getting started is a non-user account with administrative privileges (sudo access).
If already have one you can skip this section.
su -
adduser your_username
usermod -aG sudo your_username
su - your_username
Before we install anything first update the apt packages.
sudo apt-get update
Then install some packages that will let us install Docker over HTTPS.
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Now that we have the necessary packages we proceed to download the GPG key for docker and add it to the apt sources.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
And finally we install docker
sudo apt install docker-ce
We only need three commands to get our server up and running on our Ubuntu machine.
The first command will pull the docker image. This docker image already includes all the instructions to setup the server, so we won't have to deal with all the server configuration.
sudo docker pull sirplexus/minecraft-server-standalone:latest
After pulling the image we execute the command that will create and configure our docker container.
sudo docker container create --publish your_public_ip_address:25565:25565/tcp --name "My-Minecraft-Server" --env RAM=2G sirplexus/minecraft-server-standalone
Finally we run the server with this command.
sudo docker container start My-Minecraft-Server
Also to stop the server anytime you want, run this command.
sudo docker stop My-Minecraft-Server
The final step is to open the port that your clients will need to access.
sudo ufw allow 25565/tcp
Additionally, you might have to tell your internet provider you need to open that port. This is just in case that the machine your are running this server from is on your home network.
If you will run this from a cloud service solution like DigitalOcean or Google Cloud Platform then opening the port using the command above may be enough.
To access the server, just add the server address from the game menu and put whatever name you like.
your_public_ip_address:25565
dockers are stupid. you shuld just use the god tham binnary stop making stuff more complicated than it needs to be. follow the unix filosofty