docker-minecraft-server: MTU mismatch causing server jar download to fail

Describe the problem

I just pulled the most recent version of this image and changed the server version to 1.20.1 and now the server is not starting anymore, but instead crashing because of the ssl timeout for some reason. I’ve included all the logs below.

Container definition

version: '2.3'
services:
        minecraft:
                image: itzg/minecraft-server
                environment:
                        MEMORY: '8G'
                        EULA: 'TRUE'
                        VERSION: '1.20.1'
                volumes:
                        - ./usbcraft:/data
                ports:
                        - 25565:25565
                restart: always

Container logs

Starting minecraft_minecraft_1 ... done
Attaching to minecraft_minecraft_1
minecraft_1  | [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 12 1000 1000 4096 Jul  7 20:43 /data'
minecraft_1  | [init] Resolving type given VANILLA
minecraft_1  | [mc-image-helper] 20:47:31.137 ERROR : 'resolve-minecraft-version' command failed. Version is 1.32.5
minecraft_1  | reactor.core.Exceptions$ReactiveException: io.netty.handler.ssl.SslHandshakeTimeoutException: handshake timed out after 30000ms
minecraft_1  |  at reactor.core.Exceptions.propagate(Exceptions.java:408)
minecraft_1  |  at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:100)
minecraft_1  |  at reactor.core.publisher.Mono.block(Mono.java:1712)
minecraft_1  |  at me.itzg.helpers.versions.ResolveMinecraftVersionCommand.call(ResolveMinecraftVersionCommand.java:26)
minecraft_1  |  at me.itzg.helpers.versions.ResolveMinecraftVersionCommand.call(ResolveMinecraftVersionCommand.java:12)
minecraft_1  |  at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
minecraft_1  |  at picocli.CommandLine.access$1500(CommandLine.java:148)
minecraft_1  |  at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
minecraft_1  |  at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
minecraft_1  |  at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
minecraft_1  |  at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
minecraft_1  |  at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
minecraft_1  |  at picocli.CommandLine.execute(CommandLine.java:2170)
minecraft_1  |  at me.itzg.helpers.McImageHelper.main(McImageHelper.java:149)
minecraft_1  |  Suppressed: java.lang.Exception: #block terminated with an error
minecraft_1  |          at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:102)
minecraft_1  |          ... 12 common frames omitted
minecraft_1  | Caused by: io.netty.handler.ssl.SslHandshakeTimeoutException: handshake timed out after 30000ms
minecraft_1  |  at io.netty.handler.ssl.SslHandler$7.run(SslHandler.java:2125)
minecraft_1  |  at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
minecraft_1  |  at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:153)
minecraft_1  |  at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
minecraft_1  |  at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
minecraft_1  |  at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
minecraft_1  |  at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:406)
minecraft_1  |  at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
minecraft_1  |  at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
minecraft_1  |  at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
minecraft_1  |  at java.base/java.lang.Thread.run(Unknown Source)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

SOLVED!

It was a MTU problem, my network setup is not straight forward as I have all my docker containers connected to the internet through a wiregard VPN so I can use the static IP from a small VSP I rent:

$ ip a show dev wg1
27: wg1: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1400 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none
    inet 10.102.0.3/24 scope global wg1
       valid_lft forever preferred_lft forever

So the MTU is not the default 1500 as it is in most networks but 1400 as you can see from the output above. Docker dosen’t automatically configure continers the same way, but just uses the normal 1500:

# ip a show dev eth0
75: eth0@if76: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue
    link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
       valid_lft forever preferred_lft forever

I’ve been using this setup for as long as I’ve used this docker image, so I have no idea why it stopped working just now. To solve this I changed my docker-compose.yml to:

version: '2.3'
services:
        minecraft:
                image: itzg/minecraft-server
                environment:
                        MEMORY: '8G'
                        EULA: 'TRUE'
                        VERSION: '1.20.1'
                volumes:
                        - ./usbcraft:/data
                ports:
                        - 25565:25565
                restart: always
                networks:
                        - mc_net

networks:
        mc_net:
                driver: bridge
                driver_opts:
                        com.docker.network.driver.mtu: 1400

Now even inside the container the MTU is set to 1400 and everything works nicely.

Even tho I don’t think my specific OS, kernel or Docker have something to do with this problem this is what I’m running:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal
$ docker --version
Docker version 20.10.21, build 20.10.21-0ubuntu1~20.04.2
$ uname -r
5.15.0-76-generic

I’m so glad you found the cause and thanks for posting your research here. This will be great help for anyone else that runs into this.