TunnelNet Guides

Self-host a Minecraft server behind CGNAT with Docker (tested)

2026-11-29

A Minecraft server at home is easy until your friends cannot reach it. If your internet provider shares one address between many customers (CGNAT), or your router will not forward ports, nobody outside can join. This page runs a Minecraft Java Edition server in Docker and reaches it from the internet through a TunnelNet address.

Tested on

Date: 18 November 2026 · Host: Debian 12, Docker Engine 29.10.0 and Docker Compose v5.8.0, a test virtual machine with 2 CPUs and 2 GB of memory, behind a NAT router with no port forwarding. This is not carrier CGNAT, but inbound behaves the same. · Server: Minecraft Java Edition 26.3 (vanilla), run with the community image itzg/minecraft-server, which downloads the official server when it starts · On the real service: the normal TunnelNet installer, on an internal test account · The player: a test machine in Atlanta that did the same "server list ping" the game's Multiplayer screen does. We did not join with a real game client. We checked that the server answers the Multiplayer screen's ping from outside, with the right version and message. Playing in the world was not tested. Also not tested: Bedrock Edition and UDP, mods (Paper, Fabric), the whitelist, several players and lag (the 48 ms ping was one sample from Atlanta), and carrier CGNAT itself. The address 203.0.113.47 is a documentation example.

Before you start

You need a Docker host with TunnelNet installed, so it has its own public address and nothing is open yet. The install is shown in Expose a Docker container without port forwarding.

1. The compose file, and the EULA

Minecraft's server needs you to accept its end-user licence agreement. Read the Minecraft EULA yourself and decide. In the file below, EULA: "TRUE" means you accept it. We set it for our test run; set it only if you agree.

This is the compose.yaml we ran, in /srv/minecraft:

services:
  mc:
    image: itzg/minecraft-server:latest
    restart: unless-stopped
    ports:
      - "25565:25565"
    environment:
      EULA: "TRUE"
      TYPE: VANILLA
      MEMORY: 1G
      MOTD: TEST-4889 lab server
      DIFFICULTY: easy
      VIEW_DISTANCE: 6
    volumes:
      - data:/data
volumes:
  data:

2. Start it

$ sudo docker compose up -d
 Container minecraft-mc-1 Started
$ sudo docker compose logs mc | grep -E "Starting minecraft server version|Done"
[03:23:00] [Server thread/INFO]: Starting minecraft server version 26.3
[03:23:10] [Server thread/INFO]: Done (9.379s)! For help, type "help"
$ sudo docker compose exec mc rcon-cli list
There are 0 of a max of 20 players online:

The first start took about 2.5 minutes in all (140 seconds), including the download. Memory in use on the host with the server running was about 1.4 GB, so 2 GB of memory is the bare minimum for a couple of friends.

Undo: sudo docker compose stop.

3. Before opening: it does not answer

From the outside machine, the server-list ping to 203.0.113.47:25565 timed out.

4. Open the game port

$ sudo tnet ports allow tcp 25565 --note=minecraft
Allowed tcp 25565

From the outside machine:

03:24:20 server-list ping -> 203.0.113.47:25565: version 26.3, players 0/20, motd "TEST-4889 lab server", ping 48 ms   (40 s after allow)

Players add the server as 203.0.113.47. 25565 is the default port, so no :port is needed.

Undo:

$ sudo tnet ports deny 25565
Denied port 25565

It stopped answering 61 seconds later.

Keep it for your friends

  • Keep online-mode on (the image's default), so only real accounts can join.
  • Use a whitelist for a friends-only server (the image has ENABLE_WHITELIST and WHITELIST settings). We did not test the whitelist.
  • Port 25565 is scanned constantly by server finders. Expect strangers to try soon after you open it. That is another reason for the whitelist.
  • Bedrock Edition (phones and consoles) uses UDP port 19132, which would be sudo tnet ports allow udp 19132. We did not test it.

Limits

  • The server sees players as coming from TunnelNet, not from their own address, so IP bans in the server will not work. Ban by player name.
  • 1 TB a month is included, then 10 Mbit/s until the 1st of the month (an extra 1 TB costs $15). A small server uses a fraction of that.