Reputation: 97
I am new to docker and just started playing around with it. I am working on spring-boot micro-service. I have a total of 5 micro-services and all of them are using JDK 8. I was wondering if I can run some of them with different JDK version e.g, OpenJDK 10. Is this possible to do? If yes how will a specify the dockerfile and docker-compose?
Upvotes: 0
Views: 651
Reputation: 547
Yes, it is possible. You can you use like below:
DockerFile:
ARG JDK_Path
FROM $JDK_PATH
//rest of your docker file code
Now build you Dockerfile with the following command:
docker build --build-arg JDK_PATH=/jdk8.0 image_1 .
docker build --build-arg JDK_PATH=/jdk10.0 image_2 .
Upvotes: 2