Gibbs
Gibbs

Reputation: 22956

Base image for java

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?

Upvotes: 3

Views: 6646

Answers (2)

n2o
n2o

Reputation: 6477

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.

Upvotes: 2

Frank Neblung
Frank Neblung

Reputation: 3175

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)

Upvotes: 1

Related Questions