Minecraft Docker Connection Problem

Hello everyone,

So i have created a docker container with a docker-compose for configure my minecraft server. Here what i have

version: "1"

    image: itzg/minecraft-server
      - 25565:25565
      EULA: "TRUE"
      VERSION: 1.19.4
      INIT_MEMORY: 1024M
      MAX_MEMORY: 4G
    tty: true
    stdin_open: true
    restart: unless-stopped
      - ./minecraft-data:/data

And on my wifi box, i configure the forwards ports and the proxy for allow my friends to connect on my server. But, in localhost, no problem, but my friends can’t connect to my server. I search everywhere on the net and i haven’t found anything.

I’m on Windows with Docker Desktop 4.19.0 and my Internet service provider is Bouygues Telecom (France).

Thanks everyone, i’m sorry for my english, i’m french and don’t speak english very well… :slight_smile:

The compose file is correct. If your friends can’t connect from another machine, that is either a proxy issue (since you mentioned it) or a firewall issue.

Since you also mentioned Docker Desktop for Windows, my guess is the firewall as I always needed to allo external connections in the Windows firewall.

Could also be incorrect port forwarding from the router to the Windows pc or a carrier-grade NAT.

You can use https://canyouseeme.org to check whether the WAN port is accessible from the internet.
Also, it doesn’t hurt to compare the IP from canyouseeme.org with the WAN ipv4 your router shows. If both are not identical then you high likely have a carrier grade NAT.

So the solution is to allow connection in the firewall on my computer ? Nevertheless, i created another minecraft server but without docker and my friends can connect to my server. I don’t use this solution because i prefer to have my minecraft server on Docker for the simplicity of configuration.

When I use https://canyouseeme.org/ to check, it say " Error: I could not see your service on on port (25565 )", the reason why my friends can’t connect to my server. However, the website show my public ip, and it’s the same ip display on my router.

Seeing the same IP on the website and your router is a good sign :slight_smile:

You need to make sure that you have a portfowarding of the wan port 25565 for the tcp protocol to your windows host port 25565. This should work as long as you use Docker Desktop for Windows.

It will not work like this with docker-ce in an arbitrary WSL2 distribution. This scenario would require additional tinkering with the windows firewall.

That was my guess, but I think I needed to configure the firewall when I did what @meyay mentioned

I didn’t remember it until now. Or did you eventually have to configure the firewall too?

Docker Desktop bypasses the restriction WSL2 has. Any lan ip can access the containers using the lan-ip of the windows host and the published port.

I put in “protocol’ section in “both” (TCP & UDP) and the redicrection is my computer (MSILucasMdr) with the minecraft port on my router.
It’s written “The “Minecraft Lucas Server” rule redirects all protocols for internet streams having port 25565 of the bbox to port 25565 of the device 192.168…”
My internet box possesses a firewall too so i configurate it for accept connections :

Here, the firewall accept all source ip with the minecraft towards my computer with the same port for UDP and TCP protocol. It’s written " The “Minecraft Lucas Server” rule allows packets with TCP and UDP protocol and port 25565 to IP address 192.168… and to port 25565.”
But, nothing work. Unless i misconfigured my router or i misunderstood your answer.
I have nothing configured on my computer in the firewall, maybe it’s the problem ?

Lets recap: you have a publicly accessible wan ipv4 and port forwarding is configured properly from WAN 25565/tcp to host-ip:25565/tcp.

Thus, your configuration should work, unless there is a firewall on the Windows host.

Yesterday evening I tested it with Docker Desktop in a different subnet and a test client in a different subnet successfully. I would expect it to not make any difference if the source-ip is a public ip. I am using the default Windows firewall, and I hadn’t had to configure anything.

Actually, my girlfriend is at my house, so i’m testing if she can connect to my server in local with my ip adress and the port, and it’s doesn’t work to, in conclusion, my computer block all connections. Same issues if i connect her computer with the 4th generation mobile telephony standard with my public ip.
First, my girlfriend’s computer was connected on my WIFI. I disabled private firewall on my computer : Doesn’t work.
Same thing but with the public firewall, and it’s work !
Now, I do the same thing but she doesn’t connected on my WIFI and I connect it with my public IP, and it’s work too, so the problem is my public firewall.
EDIT : I see where i can add rule for my public firewall. So, I add a rule for accept connection with the TCP protocol with 25565 port, but nothing to happen.

2nd EDIT : Problem solved ! The problem was TCP protocol with Docker was refused, so i active all and it’s work now ! Very thanks all :slight_smile:
For future people who will have the same problem :
For configurate the public firewall, go to Windows → Parameters and search “Firewall and network protection”.
Bellow Public firewall, go to “advanced parameters”.
Search “Docker Desktop Backend” and active all disabled Docker rules (in red).
And normally, that’s it !

1 Like