<p>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.</p>

<p>Here's the minimum Dockerfile that bake JRE 11 to the mongo image.</p>
<pre><code>FROM mongo:latest

# Replace the version if desired
RUN apt-get update -y &amp;&amp; apt-get install openjdk-11-jre-headless -y

# Install your app and stuffs here...

# Override for your own command
CMD [&quot;java&quot;,&quot;-version&quot;]
</code></pre>
<p>Build the image <code>docker build -t mongodb-java .</code></p>
<p>Test the image <code>docker run -t --rm mongodb-java</code> will output the JRE version.</p>
<p>Test the image <code>docker run -t --rm mongodb-java mongo --version</code> will output the MongoDB version.</p>
<p>You can then follow Kaniko <a href="https://github.com/GoogleContainerTools/kaniko#running-kaniko-in-docker" rel="nofollow noreferrer">steps</a> to build the image.</p>
