The previous article covered downloading and installing Minecraft on Windows so you can play on your own computer. But how do you play with friends? There are three main methods:
-
LAN: Similar to high school computer lab class playing CS together, when all devices connect to the same Wi-Fi (same LAN), a friend’s Minecraft room broadcasts through the router. If my computer is on the same router, I can find and join their broadcast. The downside is obvious: devices must be on the same subnet, and we must live together.
-
VPN: Since we don’t live together, we can add the friend to my subnet. For example, I run Wireguard VPN at home and let a friend connect. They then join my subnet and can play with me.
-
Using someone else’s server: The above methods have an issue—if a friend wants to join my room, I must be online, otherwise they can’t find it. A server solves this since it runs 24/7. I’ve used server rental services before, but now with a mini PC, I can host my own.
This article covers building a Minecraft server on a personal server. You can install everything directly on the server, but I prefer using Docker to isolate and manage programs.
Requirements
- A mini PC or old computer running Debian, capable of running 24/7
Installation Guide
Preparation
-
Install Docker. Since my Debian has no GUI (only command line), I only need Docker Engine. See Docker’s official docs.
-
Create directories. SSH into your mini PC and create a folder where you want the server, like
~/minecraft:cd ~ mkdir minecraft cd minecraft -
To manage different game versions, create a version folder. If your MC version is
1.18.2, createmc-1182:mkdir mc-1182 cd mc-1182
Docker
-
Prepare the Docker Compose config file
docker-compose.yml:version: "3.8" services: mc: image: itzg/minecraft-server # Image name tty: true # Support container interaction stdin_open: true # Allow command-line input ports: - "25565:25565" # Port mapping: host 25565 to container 25565 environment: EULA: "TRUE" # Required, agree to Minecraft EULA TYPE: "FORGE" # Server core type: PAPER / SPIGOT / VANILLA / FORGE / FABRIC VERSION: "1.18.2" # Minecraft version INIT_MEMORY: 1G # Initial JVM memory allocation MAX_MEMORY: 2G # Maximum JVM memory allocation ONLINE_MODE: "FALSE" # Enable authentication (FALSE allows offline play) LEVEL: "world" # World name LEVEL_SEED: "Kyxie" # World seed (string or number) # Add more environment variables as needed, format: KEY: VALUE with space after colon volumes: - ./server:/data # Mount local server folder to container /data for world and config data restart: unless-stopped # Auto-restart unless manually stopped -
For game version selection: if you want to play large modpacks like Tinkers’ Construct or modded industrial content,
1.18.2is good withFORGE. For lightweight survival, try1.20.1withPAPER. -
Run Docker Compose:
docker compose up -d -
The server is now running. Open HMCL, click Launch Game, wait to enter, click Multiple Player, then Add a server. Enter the server’s IP address:
Configure Admin
-
Make yourself an operator (OP) by modifying server data.
-
First find the container ID:
docker psThe first
CONTAINER IDis what you need. -
Enter to monitor the container’s main process:
docker attach <CONTAINER ID> -
In the terminal, type:
op <Your Username>My username is
Kyxie. Note it’s case-sensitive. -
To exit, use
CTRL PthenCTRL Q, notCTRL C.
Common Commands
- Start or restart the container from Linux terminal:
docker compose up -d(same as before) - After making someone OP, they can type
/in-game to open a terminal with the same effect asdocker attach - Switch game mode:
/gamemode creativefor Creative mode. Other modes can be auto-completed. - Stop server:
/stop
For detailed documentation, see: Minecraft Server on Docker (Java Edition)
Remote Access
You’ve successfully built a Vanilla Minecraft server. Now expose it to the public internet. You have options:
- No public IP: Use tunneling like ZeroTier, Cloudflare ZeroTrust, or similar services
- Have public IP: Use router port forwarding. The 25565 port mentioned in the Docker Compose file is what the router should forward. Requests from the internet to port 25565 reach the router, which forwards to the mini PC’s 25565.
Port Forwarding
Since I have a public IP, I’ll only cover this method. Many domestic users lack public IPs and have plenty of tunneling tutorials available.
-
Open your router’s Web Manager. Mine is
192.168.2.1(common alternatives are192.168.1.1). -
Configure inbound/outbound rules:
Rule Name Protocol Internal Port External Port Local IP Address Minecraft TCP 25565 25565 Server’s IP -
Enter the backend (
docker attachor in-game terminal) and type:whitelist on -
Add friends’ usernames to the whitelist (OPs can always join):
whitelist add Kyxie whitelist add friend_username whitelist reload -
Friends can now join using your public IP.
-
Some ISPs change IP addresses frequently. If you have a domain, use DDNS to map IP to domain. See: OpenWrt DDNS Configuration | Kunyang’s Blog