update base java version to 25, make dependencies explicit, and document container upgrade process

This commit is contained in:
2026-08-29 00:19:55 -05:00
parent ab78ff93ae
commit ffc7ca5271
3 changed files with 32 additions and 4 deletions
+7 -1
View File
@@ -8,13 +8,19 @@ RUN unzip -j /usr/bin/mcrcon.zip -d /usr/bin/mc-rcon && chmod a+x /usr/bin/mc-rc
# actual image # actual image
FROM eclipse-temurin:21 FROM eclipse-temurin:25
# included in case the base image doesn't include wget (known bug 08/2026)
RUN apt-get update && apt-get install -y wget ca-certificates
COPY --from=builder /usr/bin/mc-rcon /usr/bin/mc-rcon COPY --from=builder /usr/bin/mc-rcon /usr/bin/mc-rcon
COPY scripts/start-server.sh /usr/bin/start-server.sh COPY scripts/start-server.sh /usr/bin/start-server.sh
RUN chmod a+x /usr/bin/start-server.sh RUN chmod a+x /usr/bin/start-server.sh
COPY scripts/mcrcon /usr/bin/mcrcon COPY scripts/mcrcon /usr/bin/mcrcon
RUN chmod a+x /usr/bin/mcrcon RUN chmod a+x /usr/bin/mcrcon
COPY template/ /defaults/ COPY template/ /defaults/
WORKDIR /minecraft_data WORKDIR /minecraft_data
+24 -2
View File
@@ -16,7 +16,7 @@ git clone https://gitea.jovan04.com/evan/minecraft-docker && cd minecraft-docker
### Build the Image ### Build the Image
```sh ```sh
docker build -t minecraft_server . docker build --pull -t minecraft_server .
``` ```
### Run with Docker Compose ### Run with Docker Compose
@@ -36,7 +36,29 @@ On first startup (when the data volume is empty):
* A default RCON configuration is written * A default RCON configuration is written
* `server.jar` is downloaded from a provided link * `server.jar` is downloaded from a provided link
On subsequent startups, existing files are reused unchanged and environment variables are unused. On subsequent startups, existing files are reused unchanged and environment variables are unused. To reset the server or create a new one, change the name in `volumes: data: name: new_volume_name` in the `docker-compose.yml` file.
### Upgrading Java Version
Occasionally, Minecraft will update the Java version they compile their class files with. Because the Java runtime is pre-bundled with the Docker container, an update from Minecraft requires an update and rebuild of the Docker container.
You can tell this is required if there are errors like the following when trying to start the server:
```
minecraft_server | Error: LinkageError occurred while loading main class net.minecraft.bundler.Main
minecraft_server | java.lang.UnsupportedClassVersionError: net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 69.0), this version of the Java Runtime only recognizes class file versions up to 65.0
minecraft_server exited with code 1 (restarting)
```
To upgrade, change the base eclipse-temurin image's version to one supported by the latest Minecraft version. In `./Dockerfile`:
```
# previously, eclipse-temurin:21
FROM eclipse-temurin:25
```
Then, rebuild the container and start as normal:
```sh
docker build --pull -t minecraft_server .
docker compose up -d
```
### RCON Access ### RCON Access
Minecraft implements the Remote Console (RCON) protocol, which allows server administrators to remotely execute commands. See more info [here](https://minecraft.wiki/w/RCON) and [here](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol). RCON access is enabled automatically from inside the container only. **Do not expose the RCON service to the internet directly!!!** RCON is not encrypted, so exposing this service can give hackers direct access to your server's administrator console. Minecraft implements the Remote Console (RCON) protocol, which allows server administrators to remotely execute commands. See more info [here](https://minecraft.wiki/w/RCON) and [here](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol). RCON access is enabled automatically from inside the container only. **Do not expose the RCON service to the internet directly!!!** RCON is not encrypted, so exposing this service can give hackers direct access to your server's administrator console.
+1 -1
View File
@@ -7,7 +7,7 @@ if ! test -f /minecraft_data/server.jar; then
echo "ERROR: SERVER_JAR_DOWNLOAD_URL not set for initial volume creation" echo "ERROR: SERVER_JAR_DOWNLOAD_URL not set for initial volume creation"
exit 1 exit 1
fi fi
wget -O /minecraft_data/server.jar "${SERVER_JAR_DOWNLOAD_URL}" wget --no-verbose -O /minecraft_data/server.jar "${SERVER_JAR_DOWNLOAD_URL}"
fi fi
# server.properties # server.properties