A Dockerfile For Python Programs that Require Java

Here’s a Dockerfile that:

  1. Starts with Alpine 3.12 and OpenJDK 15
  2. Installs Python 3.9.1 using pyenv
  3. Updates Alpine packages and removes the ones that are only needed for installing Python
  4. Runs a Python program when the container starts using the user ‘appuser’ instead of root

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store