I currently have a docker container with an Ubuntu(17.10) image installed with other packages included. However, I'm currently having difficulty trying to install Java onto this container in addition to the current image.
Current Dockerfile :
FROM cityofzion/neo-privatenet
ADD files/ files/
ENTRYPOINT [ "/bin/bash" ]
When trying to find information on how to do this and testing inside of the container most suggest using this command: apt-get install -y oracle-java9-installer
However this results in:E: Unable to locate package oracle-java9-installer
I have also tried this suggested command wget http://download.java.net/java/GA/jdk9/9/binaries/jdk-9+181_linux-x64_bin.tar.gz
Which produces this result HTTP request sent, awaiting response...
404 Not Found - ERROR 404: Not Found.
I have only tried running these commands in the container, since that is how they would be run and they seem to be failing.
Can anyone suggest what I can include into my Dockerfile that install java onto my image?
Thanks in advance.
You can use Docker to run a Java application in a container with a specific runtime environment. This tutorial describes how to create a Dockerfile for running a simple Java application in a container with OpenJDK 17. It also shows how to create a Docker image with your application to share it with others.
Use a JRE, not a JDK When creating a Docker image, we should only assign the necessary resources to function correctly. This means that we should start by using an appropriate Java Runtime Environment (JRE) for your production image and not the complete Java Development Kit (JDK).
Intro to managing and running a containerized Java Spring Boot application. Docker is a platform for packaging, deploying, and running applications in containers. It can run containers on any system that supports the platform: a developer's laptop, systems on “on-prem,” or in the cloud without modification.
You can also directly pull any of the open-jdk images mentioned at (https://hub.docker.com/_/openjdk/) and use it. There is no need to install Ubuntu in docker image and then install Java on top of it. These images already use Ubuntu (with bare-minimum file system).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With