itzg / docker-minecraft-server

Docker image that provides a Minecraft Server that will automatically download selected version at startup
https://docker-minecraft-server.readthedocs.io/
Apache License 2.0
9.1k stars 1.5k forks source link

an internet connection is required to restart the server #2175

Open uhthomas opened 1 year ago

uhthomas commented 1 year ago

Describe the problem

It looks like the container was restarted, and rather than coming back as expected it failed to start as there was no connection to the internet. I would expect this behaviour for first start, but if the server and mods are already downloaded, why should a lack of internet connection prevent the server from starting?

Container definition

https://github.com/uhthomas/automata/blob/60fd02f4c0a34fe99e3b8d707cee5a46436ba55d/k8s/unwind/minecraft/cf_atm8/stateful_set_list.cue

Container logs

- minecraft-cf-atm8-0 › minecraft-server
+ minecraft-cf-atm8-0 › minecraft-server
minecraft-cf-atm8-0 minecraft-server chmod: changing permissions of '/data': Operation not permitted
minecraft-cf-atm8-0 minecraft-server [init] Running as uid=1000 gid=3000 with /data as 'drwxrwsr-x 22 0 2000 4096 Jun  3 20:04 /data'
minecraft-cf-atm8-0 minecraft-server [mc-image-helper] 11:28:12.166 ERROR : 'get' command failed. Version is 1.29.1
minecraft-cf-atm8-0 minecraft-server java.net.UnknownHostException: launchermeta.mojang.com: Temporary failure in name resolution
minecraft-cf-atm8-0 minecraft-server    at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
minecraft-cf-atm8-0 minecraft-server    at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(Unknown Source)
minecraft-cf-atm8-0 minecraft-server    at java.base/java.net.InetAddress.getAddressesFromNameService(Unknown Source)
minecraft-cf-atm8-0 minecraft-server    at java.base/java.net.InetAddress$NameServiceAddresses.get(Unknown Source)
minecraft-cf-atm8-0 minecraft-server    at java.base/java.net.InetAddress.getAllByName0(Unknown Source)
minecraft-cf-atm8-0 minecraft-server    at java.base/java.net.InetAddress.getAllByName(Unknown Source)
minecraft-cf-atm8-0 minecraft-server    at java.base/java.net.InetAddress.getAllByName(Unknown Source)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:43)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:447)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:162)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:172)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:142)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:96)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:152)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:115)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
minecraft-cf-atm8-0 minecraft-server    at me.itzg.helpers.http.LatchingUrisInterceptor.execute(LatchingUrisInterceptor.java:27)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:245)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:188)
minecraft-cf-atm8-0 minecraft-server    at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:162)
minecraft-cf-atm8-0 minecraft-server    at me.itzg.helpers.get.GetCommand.processSingleUri(GetCommand.java:439)
minecraft-cf-atm8-0 minecraft-server    at me.itzg.helpers.get.GetCommand.call(GetCommand.java:187)
minecraft-cf-atm8-0 minecraft-server    at me.itzg.helpers.get.GetCommand.call(GetCommand.java:54)
minecraft-cf-atm8-0 minecraft-server    at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
minecraft-cf-atm8-0 minecraft-server    at picocli.CommandLine.access$1500(CommandLine.java:148)
minecraft-cf-atm8-0 minecraft-server    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
minecraft-cf-atm8-0 minecraft-server    at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
minecraft-cf-atm8-0 minecraft-server    at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
minecraft-cf-atm8-0 minecraft-server    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
minecraft-cf-atm8-0 minecraft-server    at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
minecraft-cf-atm8-0 minecraft-server    at picocli.CommandLine.execute(CommandLine.java:2170)
minecraft-cf-atm8-0 minecraft-server    at me.itzg.helpers.McImageHelper.main(McImageHelper.java:139)
minecraft-cf-atm8-0 minecraft-server [init] ERROR: version lookup failed:
itzg commented 1 year ago

I can probably fix that particular spot, but there's probably 20 steps after that that assume basic network connectivity.

itzg commented 1 year ago

Actually, the linked PR probably doesn't fully resolve this.

NernKat commented 9 months ago

Just realized this and would appreciate it for full lan experience by being able to shut the Internet connection from the container.

jamescmeyer commented 8 months ago

Thank you very much for providing this! I've been slow on picking up exactly how to work much with Docker, and your Portainer image has been of great service to me and joy to my children. I'm commenting to second the desire to make this something that can be run entirely offline. My internet was out this morning, and when trying to start the server on my Asustor NAS, the log kept hanging on something about connecting to Bukkit for some jar file that was already available where the server runs from. I don't know that the problem was Bukkit specifically, I didn't have the time to set it back to being a normal server (nor the courage to fix something that normally isn't broken), but I found this issue when looking into possible solutions.

itzg commented 8 months ago

I can put more effort into optimizing the download operations to skip existing, non-ambiguous (aka not "latest") types and versions; however, keep in mind that the Minecraft server itself will want to verify connecting users via Microsoft/Mojang's authentication system. So, honestly I don't feel highly motivated to provide a network-free solution when we're at the mercy of external software ultimately. Even more so, I am not inclined to put much further effort into Bukkit/Spigot support specifically since the builds provider, getbukkit.org, has had numerous stability issues lately

image

Please consider using PaperPC instead, which is plugin compatible and has robust support. Furthermore, the download of PaperMC has already been optimized to avoid download/lookup when an exact version is specified.

P.S. sorry for the ranting and whining, but just wanted to be fully transparent.