The use case is such that I need both JDK and Mongo images in a single container, the java process starts up the Mongo daemon process.
The use case is such that I need both JDK and Mongo images in a single container, the java process starts up the Mongo daemon process.
2
Answers
You are not needed to use two base images. just use one of the base image jdk/mongo and then using binaries install mongo/jdk on top of the chosen base image.
Here’s the minimum Dockerfile that bake JRE 11 to the mongo image.
Build the image
docker build -t mongodb-java .
Test the image
docker run -t --rm mongodb-java
will output the JRE version.Test the image
docker run -t --rm mongodb-java mongo --version
will output the MongoDB version.You can then follow Kaniko steps to build the image.