Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Base image for java

Tags:

docker

I am going to use java7 from docker repository.

I understand that every image has a base image. I would like to know what is the base image for all Java versions in the docker repository?

like image 265
Gibbs Avatar asked Nov 28 '25 22:11

Gibbs


2 Answers

That depends on the image. Some use Debian, some use Alpine. That's, as far as I know, in most projects the case.

You can view the Dockerfiles when you are on DockerHub. For example, the eclipse temurin base image has several Tags and the Dockerfiles are linked to it.

temurin 17-alpine uses this Dockerfile which uses Alpine Linux. You can see different variants in the READMEs, the search, or guess their suffixes.

like image 145
n2o Avatar answered Nov 30 '25 15:11

n2o


To inherit java by your base image is not the only way to use java in your container.

Dockerfile:

FROM ubuntu:14.04
RUN apt-get update -y && apt-get install -y openjdk-7-jre

Build your image:

docker build -t ubuntu-jre7 .

And run your container:

docker run --rm -t ubuntu-jre7 java -version

Will produce the following output (at the time of writing):

java version "1.7.0_131"
OpenJDK Runtime Environment (IcedTea 2.6.9) (7u131-2.6.9-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)
like image 31
Frank Neblung Avatar answered Nov 30 '25 15:11

Frank Neblung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!