docker-minecraft-server
docker-minecraft-server copied to clipboard
Unable to create new containers with 1.20.5 and 1.20.6
Describe the problem
I'm having an issue creating new containers for version 1.20.5 and 1.20.6 on Ubuntu 22.04.
I've pulled the latest versions of both of the java17 and java21 tagged images. I may be doing something silly!
Container definition
With java21:
version: "3"
services:
server:
image: itzg/minecraft-server:java21
volumes:
- /data/minecraft-challenge-2024:/data
ports:
- "25565:25565"
environment:
- "EULA=TRUE"
- "VERSION=1.20.6"
- "MEMORY=4G"
With java17:
version: "3"
services:
server:
image: itzg/minecraft-server:java17
volumes:
- /data/minecraft-challenge-2024:/data
ports:
- "25565:25565"
environment:
- "EULA=TRUE"
- "VERSION=1.20.6"
- "MEMORY=4G"
Container logs
With java21:
server_1 | [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 2 1000 1000 4096 May 22 12:36 /data'
server_1 | [init] ERROR: your Docker provider has an annoying flaw where it
server_1 | [init] tries to set PATH even though the container establishes
server_1 | [init] a very specific value.
server_1 | [init] ERROR: could not locate path that contains java
minecraftchallenge2024_server_1 exited with code 1
With java17:
server_1 | [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 2 1000 1000 4096 May 22 12:37 /data'
server_1 | [init] Resolving type given VANILLA
server_1 | [init] Resolved version given 1.20.6 into 1.20.6
server_1 | [init] Downloading 1.20.6 server...
server_1 | [init] Creating server properties in /data/server.properties
server_1 | [init] Disabling whitelist functionality
server_1 | [mc-image-helper] 12:40:44.537 INFO : Created/updated 4 properties in /data/server.properties
server_1 | [init] Setting initial memory to 4G and max to 4G
server_1 | [init] Starting the Minecraft server...
server_1 | Error: LinkageError occurred while loading main class net.minecraft.bundler.Main
server_1 | java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
server_1 | 2024-05-22T12:40:51.822Z WARN mc-server-runner Minecraft server failed. Inspect logs above for errors that indicate cause. DO NOT report this line as an error. {"exitCode": 1}
server_1 | 2024-05-22T12:40:51.822Z INFO mc-server-runner Done
minecraftchallenge2024_server_1 exited with code 1
You definitely need to be using the java21 image but note the error
server_1 | [init] ERROR: your Docker provider has an annoying flaw where it
server_1 | [init] tries to set PATH even though the container establishes
server_1 | [init] a very specific value.
Are you using Portainer? It's usually the one that breaks the PATH variable like that.
A docker compose down and then docker compose up -d might fix it since it would give a fresh container (but existing volume mapping) to be created.
Hmm, no, I'm just using regular docker and docker compose via the CLI.
I'll make sure I'm not using super old versions, it could be that.
I have same issue on my server and also on the local machine.
Error: LinkageError occurred while loading main class net.minecraft.bundler.Main java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
I am traiing to start server on my qnap ts431 server and there I need to run from image java17, because of arm32. On my local windows machine it does not work as well with same error. Looks like that old version of java is inside of the container.
When I modified the version and set 1.20.4 that it is looks like that it works.
Same issue - regular docker and docker-compose
docker-compose up
[init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 12 1000 1000 4096 Jun 8 02:59 /data'
[init] ERROR: your Docker provider has an annoying flaw where it
[init] tries to set PATH even though the container establishes
[init] a very specific value.
[init] ERROR: could not locate path that contains java
22:04:23 ✘ user@nas002 ~ ⬡ v12.22.9
> java --version
openjdk 17.0.11 2024-04-16
OpenJDK Runtime Environment (build 17.0.11+9-Ubuntu-122.04.1)
OpenJDK 64-Bit Server VM (build 17.0.11+9-Ubuntu-122.04.1, mixed mode, sharing)
22:04:50 user@nas002 ~ ⬡ v12.22.9
> which java
/usr/bin/java
> docker run -e EULA=TRUE itzg/minecraft-server
[init] Running as uid=1000 gid=1000 with /data as 'drwxr-x--- 2 1000 1000 4096 Jun 5 12:48 /data'
[init] ERROR: your Docker provider has an annoying flaw where it
[init] tries to set PATH even though the container establishes
[init] a very specific value.
[init] ERROR: could not locate path that contains java
@darkweasel77 , run the following and provide the output of those
docker image inspect -f '{{json .Config.Labels}}' itzg/minecraft-server
docker run --rm --entrypoint bash itzg/minecraft-server -c 'echo $PATH; ls -l /opt/java/openjdk/bin/java'
If I specify something other than latest (say java11 or java17):
mcworld:
container_name: mcworld
image: itzg/minecraft-server:java11
ports:
- 25565:25565
environment:
EULA: "TRUE"
volumes:
- ./_minecraft:/data
restart: unless-stopped
I get:
mcworld | [init] Resolved version given LATEST into 1.20.6
mcworld | [init] Downloading 1.20.6 server...
mcworld | [mc-image-helper] 03:27:59.322 INFO : Created/updated 1 property in /data/server.properties
mcworld | [init] Setting initial memory to 1G and max to 1G
mcworld | [init] Starting the Minecraft server...
mcworld | Error: LinkageError occurred while loading main class net.minecraft.bundler.Main
mcworld | java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 55.0
mcworld | 2024-06-08T03:28:09.938Z WARN mc-server-runner Minecraft server failed. Inspect logs above for errors that indicate cause. DO NOT report this line as an error. {"exitCode": 1}
mcworld | 2024-06-08T03:28:09.938Z INFO mc-server-runner Done
@itzg I just installed jdk21 to see if that made a difference.
> docker image inspect -f '{{json .Config.Labels}}' itzg/minecraft-server
{"org.opencontainers.image.authors":"Geoff Bourne <[email protected]>","org.opencontainers.image.created":"2024-06-05T23:48:47.659Z","org.opencontainers.image.description":"Docker image that provides a Minecraft Server that will automatically download selected version at startup","org.opencontainers.image.licenses":"Apache-2.0","org.opencontainers.image.ref.name":"ubuntu","org.opencontainers.image.revision":"c828985ebe36c44ef57d5af133e1bf38f534ea31","org.opencontainers.image.source":"https://github.com/itzg/docker-minecraft-server","org.opencontainers.image.title":"docker-minecraft-server","org.opencontainers.image.url":"https://github.com/itzg/docker-minecraft-server","org.opencontainers.image.version":"java21"}
and
docker run --rm --entrypoint bash itzg/minecraft-server -c 'echo $PATH; ls -l /opt/java/openjdk/bin/java'
/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-rwxr-xr-x 1 root root 12920 Apr 17 07:05 /opt/java/openjdk/bin/java
@darkweasel77 I really wanted to see what image you had pulled previously, which is why I requested the output of the specific command I provided. In any case, It'll probably work now.
@itzg I'll set it back; w/ jdk21 I'm back to getting what I posted above.
mcworld:
container_name: mcworld
image: itzg/minecraft-server:java17
ports:
- 25565:25565
environment:
EULA: "TRUE"
volumes:
- ./_minecraft:/data
restart: unless-stopped
> which java
/usr/bin/java
> java --version
openjdk 17.0.11 2024-04-16
OpenJDK Runtime Environment (build 17.0.11+9-Ubuntu-122.04.1)
OpenJDK 64-Bit Server VM (build 17.0.11+9-Ubuntu-122.04.1, mixed mode, sharing)
mcworld | [init] Resolved version given LATEST into 1.20.6
mcworld | [mc-image-helper] 03:37:23.077 INFO : Created/updated 1 property in /data/server.properties
mcworld | [init] Setting initial memory to 1G and max to 1G
mcworld | [init] Starting the Minecraft server...
mcworld | Error: LinkageError occurred while loading main class net.minecraft.bundler.Main
mcworld | java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
mcworld | 2024-06-08T03:37:32.329Z WARN mc-server-runner Minecraft server failed. Inspect logs above for errors that indicate cause. DO NOT report this line as an error. {"exitCode": 1}
mcworld | 2024-06-08T03:37:32.329Z INFO mc-server-runner Done
> docker image inspect -f '{{json .Config.Labels}}' itzg/minecraft-server
{"org.opencontainers.image.authors":"Geoff Bourne <[email protected]>","org.opencontainers.image.created":"2024-06-05T23:48:47.659Z","org.opencontainers.image.description":"Docker image that provides a Minecraft Server that will automatically download selected version at startup","org.opencontainers.image.licenses":"Apache-2.0","org.opencontainers.image.ref.name":"ubuntu","org.opencontainers.image.revision":"c828985ebe36c44ef57d5af133e1bf38f534ea31","org.opencontainers.image.source":"https://github.com/itzg/docker-minecraft-server","org.opencontainers.image.title":"docker-minecraft-server","org.opencontainers.image.url":"https://github.com/itzg/docker-minecraft-server","org.opencontainers.image.version":"java21"}
> docker run --rm --entrypoint bash itzg/minecraft-server -c 'echo $PATH; ls -l /opt/java/openjdk/bin/java'
/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
-rwxr-xr-x 1 root root 12920 Apr 17 07:05 /opt/java/openjdk/bin/java
If i use:
mcworld:
container_name: mcworld
image: itzg/minecraft-server:latest
ports:
- 25565:25565
environment:
EULA: "TRUE"
volumes:
- ./_minecraft:/data
restart: unless-stopped
I get:
mcworld | [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 13 1000 1000 4096 Jun 8 03:27 /data'
mcworld | [init] ERROR: your Docker provider has an annoying flaw where it
mcworld | [init] tries to set PATH even though the container establishes
mcworld | [init] a very specific value.
mcworld | [init] ERROR: could not locate path that contains java
mcworld exited with code 1
@itzg maybe more context
> docker run -it --entrypoint /bin/sh itzg/minecraft-server
# java --version
[0.003s][warning][os,thread] Failed to start thread "GC Thread#0" - pthread_create failed (EPERM) for attributes: stacksize: 1024k, guardsize: 4k, detached.
[0.003s][error ][gc,task ] Failed to create worker thread
vs
> docker run -it --entrypoint /bin/sh itzg/minecraft-server:java17
# java --version
openjdk 17.0.11 2024-04-16
OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9)
OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode, sharing)
Thanks @darkweasel77 , that context seems interesting but I have no idea what it means 😀 The Java 21 is also from Eclipse Temurin so there's not a distro difference from Java 17.
I'd say try googling for the Java VM error it's giving.
@itzg FYI - I upgraded my version of docker on my server to the latest and the problem went away.
@itzg FYI - I upgraded my version of docker on my server to the latest and the problem went away.
could you give us docker versions for comparison? @darkweasel77
@VictorDrijkoningen I didn't copy the output of docker version prior to upgrade, but it was 1.xx something. Docker-compose was a unique install, not part of the system.
now:
> docker version
Client: Docker Engine - Community
Version: 26.1.4
API version: 1.45
Go version: go1.21.11
Git commit: 5650f9b
Built: Wed Jun 5 11:28:57 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 26.1.4
API version: 1.45 (minimum version 1.24)
Go version: go1.21.11
Git commit: de5c9cf
Built: Wed Jun 5 11:28:57 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.33
GitCommit: d2d58213f83a351ca8f528a95fbd145f5654e957
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Docker-compose was a unique install, not part of the system
Speaking of which, the separate docker-compose tool has been deprecated for a long time now. Instead use the builtin docker compose subcommand.
I don't disagree - I had configured this server awhile ago with ubuntu 20.04, upgraded to 22.04 but never changed docker since it 'worked'.
I followed this guide from docker to upgrade my docker sub-system.
Sorry @darkweasel77 , that comment was really directed at anyone else reading this issue 😄