docker-minecraft-server: 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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (6 by maintainers)

Most upvoted comments

Sorry @darkweasel77 , that comment was really directed at anyone else reading this issue 😄

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.

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.