Various ways to use the static python container. The base image expects the user to provide a file called entrypoint.py
to be called by the Docker CMD
. This repository provides some examples of how to use that interface.
See the execv directory for components and usage notes.
This uses the os.execv
Python method to access the underlying execv(3) syscall with the goal of the actual program running with pid 1.
See the subprocess directory for components and usage notes.
In this example, however, the subprocess Python module is used to create a subprocess for the actual program, usually running as pid 5 as a child of pid 1.
See the factor directory for compnents and usage notes.
The "factory" example is more complete and representative of a "real" Flask application. This example makes use of the psutil Python module that has been compiled into the base image's Python binary (and library .zip file). The example uses a requirements.txt
file and pip to install Flask.
The base image does not have the pip
binary because the goal is to be minimal, so how is pip install
done? It is done by using an intermediate Python image which comes with pip
.
The entrypoint.py
(loosely) uses a factory pattern to create an object for the Flask application prior to running it.