As I understand it, the python runtime in the flexible environment is essentially using the
gcr.io/google-appengine/python docker image referred to in the
custom runtime documentation except with an
ENTRYPOINT specified in the app.yaml. We can see in the linked Dockerfile repository that '
pip install -r /app/requirements.txt' is executed with
RUN which occurs at build time, thus before the image is run as a container.
If this was otherwise done when instances were created, it would add significant start up time and run the risk of having inconsistent application containers as dependencies fetched at a later time may result in different packages if versions are not explicit.