Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a docker image use executable from the host?

Tags:

java

docker

I have several Java services, each packaged as a separate jar file. I plan to package the as docker images. Do I need to bundle the Java runtime on each image, or can I rely on the fact the host (that will run the image) already has the Java runtime?

like image 338
David Rabinowitz Avatar asked Mar 09 '15 08:03

David Rabinowitz


1 Answers

You could use a volume to mount the Java runtime from the host into the container, but this makes the container less portable (as Andrew Fox points out).

If instead you use a common base image such as java:8-jre for your containers, the image will be shared between containers meaning that there is only one copy on disk (not one copy per container).

Not that in both cases, you will still have multiple JVMs running, one for each container.

like image 75
Adrian Mouat Avatar answered Sep 29 '22 07:09

Adrian Mouat