cgrgcn
cgrgcn

Reputation: 371

Why do I need a container base image like BusyBox, Alpine and JDK If my host OS is Linux and It has JDK in it?

I am new to Docker technology and I did my research according to my question. There are few similar questions like these:

What is the relationship between the docker host OS and the container base image OS?

Host-based-containers vs image-based-containers

I thought I understood Docker until I saw the BusyBox docker image

Why do you need a base image with Docker?

but I still don't understand should I use base image OS or base image JDK if I have a Linux host OS with JDK installed.

I was checking some Dockerfiles of official images on DockerHub and I saw lines like FROM ubuntu, FROM alpine, FROM openjdk:8-jdk and I don't understand why is it necessary?

I have read something about isolation or encapsulation for filesystem in container. Maybe they are used to specify container specific environment variables or arguments for Java or OS.

I will be grateful for any explanation, thanks.

Upvotes: 0

Views: 2690

Answers (1)

Scott Centoni
Scott Centoni

Reputation: 1123

By default, what's running inside the container has no access to files in the host OS. That is the point of using a container: isolation. If you have a Java installation in the host OS, and you mount that as a volume when you run the container, processes inside the container might be able to use that as their Java, but that would generally be a terrible, terrible bad practice.

Upvotes: 1

Related Questions