title: How to run Docker with python and Java?
body: <p>I need both java and python in my docker container to run some code. </p>
  
  <p>This is my dockerfile:
  It works perpectly if I don't add the <strong>FROM openjdk:slim</strong></p>
  
  <pre><code>#get python
  FROM python:3.6-slim
  
  RUN pip install --trusted-host pypi.python.org flask
  
  #get openjdk
  
  FROM openjdk:slim
  
  
  COPY . /targetdir
  WORKDIR /targetdir
  
  # Make port 81 available to the world outside this container
  EXPOSE 81
  
  CMD ["python", "test.py"]
  </code></pre>
  
  <p>And the test.py app is in the same directory:</p>
  
  <pre><code>from flask import Flask
  
  import os
  app = Flask(__name__)
  
  
  @app.route("/")
  
  def hello():
      html = "&lt;h3&gt;Test:{test}&lt;/h3&gt;"
      test = os.environ['JAVA_HOME']
  
      return html.format(test = test)
  
  
  if __name__ == '__main__':
      app.run(debug=True,host='0.0.0.0',port=81)
  </code></pre>
  
  <p>I'm getting this error: </p>
  
  <pre><code>D:\MyApps\Docker Toolbox\Docker Toolbox\docker.exe: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"python\": executable file not found in $PATH": unknown.
  </code></pre>
  
  <p>What exactly am I doing wrong here? I'm new to docker, perhaps I'm missing a step.</p>
  
  <p><strong>Additional details</strong></p>
  
  <p><strong>My goal</strong> </p>
  
  <p>I have to run a python program that runs a Java file. The python library I'm using requires the path to <code>JAVA_HOME</code>.</p>
  
  <p><strong>My issues:</strong></p>
  
  <ul>
  <li><p>I do not know Java, so I cannot run the file properly.</p></li>
  <li><p>My entire code is in Python, except this Java bit</p></li>
  <li><p>The Python wrapper runs the file in a way I need it to run.</p></li>
  </ul>