Docker Community Forums

Share and learn in the Docker community.

How to Update The Default Java Version Used Within a Container

I have a container that I use to run a service called Pterodactyl. This software is used to configure, manage, and host video game servers - amongst those is Minecraft. A recent update to Minecraft has moved the entire game over to Java 16, so I need to update the java version that runs on the container in order to run the server. I am having trouble doing so and my research keeps putting me at a dead end.

Here is what I have tried:

I used docker run -u 0 -it [imageID] /bin/bash to enter a shell to the container that runs my service.


java -version

shows Openjdk version “1.8.0_282”

I then attempted to install java 16, which required a few dependencies. Those were the apt software-properties-common and gnupg.

Once that was done, I was able to use add-apt-repository ppa:linuxuprising/java
and subsequently apt install oracle-java16-installer --install-recommends

That ran, then exited with an error because the directory /usr/share/man/man1/jar.1.gz.dpkg-tmp doesnt exist.

Sorry for the wall of text, but I wanted to provide as much context as possible since every step I take to get this container updated ends at a dead end. Any and all help is tremendously appreciated!

1 Like


How did you create this container first? By a dockerfile or from
because you should not run a container, then make changes, you should create a proper image that contains this, and then use the image