Should each docker image contain a jdk?
Clash Royale CLAN TAG#URR8PPP
up vote
8
down vote
favorite
So, I'm very new to Docker. Let me explain the context to the question.
1) I have 10 - 20 spring boot micro-service applications each running on different ports on my local machine.
2) But for migrating to docker, based on my learning, each of this service must be in a different Docker Container so as to quickly deploy or make copies.
3) For each Docker Container , we need to create a new Docker image.
4) Each Docker image must contain a JRE for the spring boot application to run. It is around 200MB max. That means each docker image is, say 350MB at max.
On the other hand, on my local PC I have only 1 JRE of 200MB and each application takes only a few MB of space.
5) Based on this,I would need 600MB on my local system, yet need 7GB for all Docker images.
Is this approach correct? Should "OpenJDK" from DockerHub be added to each image?
Why is the size of image large even if the target PC may already have JDK?
java docker spring-boot microservices
add a comment |Â
up vote
8
down vote
favorite
So, I'm very new to Docker. Let me explain the context to the question.
1) I have 10 - 20 spring boot micro-service applications each running on different ports on my local machine.
2) But for migrating to docker, based on my learning, each of this service must be in a different Docker Container so as to quickly deploy or make copies.
3) For each Docker Container , we need to create a new Docker image.
4) Each Docker image must contain a JRE for the spring boot application to run. It is around 200MB max. That means each docker image is, say 350MB at max.
On the other hand, on my local PC I have only 1 JRE of 200MB and each application takes only a few MB of space.
5) Based on this,I would need 600MB on my local system, yet need 7GB for all Docker images.
Is this approach correct? Should "OpenJDK" from DockerHub be added to each image?
Why is the size of image large even if the target PC may already have JDK?
java docker spring-boot microservices
add a comment |Â
up vote
8
down vote
favorite
up vote
8
down vote
favorite
So, I'm very new to Docker. Let me explain the context to the question.
1) I have 10 - 20 spring boot micro-service applications each running on different ports on my local machine.
2) But for migrating to docker, based on my learning, each of this service must be in a different Docker Container so as to quickly deploy or make copies.
3) For each Docker Container , we need to create a new Docker image.
4) Each Docker image must contain a JRE for the spring boot application to run. It is around 200MB max. That means each docker image is, say 350MB at max.
On the other hand, on my local PC I have only 1 JRE of 200MB and each application takes only a few MB of space.
5) Based on this,I would need 600MB on my local system, yet need 7GB for all Docker images.
Is this approach correct? Should "OpenJDK" from DockerHub be added to each image?
Why is the size of image large even if the target PC may already have JDK?
java docker spring-boot microservices
So, I'm very new to Docker. Let me explain the context to the question.
1) I have 10 - 20 spring boot micro-service applications each running on different ports on my local machine.
2) But for migrating to docker, based on my learning, each of this service must be in a different Docker Container so as to quickly deploy or make copies.
3) For each Docker Container , we need to create a new Docker image.
4) Each Docker image must contain a JRE for the spring boot application to run. It is around 200MB max. That means each docker image is, say 350MB at max.
On the other hand, on my local PC I have only 1 JRE of 200MB and each application takes only a few MB of space.
5) Based on this,I would need 600MB on my local system, yet need 7GB for all Docker images.
Is this approach correct? Should "OpenJDK" from DockerHub be added to each image?
Why is the size of image large even if the target PC may already have JDK?
java docker spring-boot microservices
java docker spring-boot microservices
asked 2 hours ago
SamwellTarly
1406
1406
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
13
down vote
accepted
Your understanding is not correct.
Docker images are formed with layers, see next diagram:
When you install a jre
in your image, let's suppose it's checksum is 91e54dfb1179
in next picture, it will occupy your disk really.
But, if all your container then base all the same image, and add different things, says, your different microservice application to the Thin R/W layer
, all containers will share the 91e54dfb1179
, so it will not be the n*m
relationship.
What you need to pay attention is to use the same base image
for all java application
as most as possible, and add different things to the Thin R/W layer
.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
13
down vote
accepted
Your understanding is not correct.
Docker images are formed with layers, see next diagram:
When you install a jre
in your image, let's suppose it's checksum is 91e54dfb1179
in next picture, it will occupy your disk really.
But, if all your container then base all the same image, and add different things, says, your different microservice application to the Thin R/W layer
, all containers will share the 91e54dfb1179
, so it will not be the n*m
relationship.
What you need to pay attention is to use the same base image
for all java application
as most as possible, and add different things to the Thin R/W layer
.
add a comment |Â
up vote
13
down vote
accepted
Your understanding is not correct.
Docker images are formed with layers, see next diagram:
When you install a jre
in your image, let's suppose it's checksum is 91e54dfb1179
in next picture, it will occupy your disk really.
But, if all your container then base all the same image, and add different things, says, your different microservice application to the Thin R/W layer
, all containers will share the 91e54dfb1179
, so it will not be the n*m
relationship.
What you need to pay attention is to use the same base image
for all java application
as most as possible, and add different things to the Thin R/W layer
.
add a comment |Â
up vote
13
down vote
accepted
up vote
13
down vote
accepted
Your understanding is not correct.
Docker images are formed with layers, see next diagram:
When you install a jre
in your image, let's suppose it's checksum is 91e54dfb1179
in next picture, it will occupy your disk really.
But, if all your container then base all the same image, and add different things, says, your different microservice application to the Thin R/W layer
, all containers will share the 91e54dfb1179
, so it will not be the n*m
relationship.
What you need to pay attention is to use the same base image
for all java application
as most as possible, and add different things to the Thin R/W layer
.
Your understanding is not correct.
Docker images are formed with layers, see next diagram:
When you install a jre
in your image, let's suppose it's checksum is 91e54dfb1179
in next picture, it will occupy your disk really.
But, if all your container then base all the same image, and add different things, says, your different microservice application to the Thin R/W layer
, all containers will share the 91e54dfb1179
, so it will not be the n*m
relationship.
What you need to pay attention is to use the same base image
for all java application
as most as possible, and add different things to the Thin R/W layer
.
answered 2 hours ago
lagom
2,83021334
2,83021334
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52849139%2fshould-each-docker-image-contain-a-jdk%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password