You can use custom runtimes to add
additional functionality to a Python app running in the flexible environment. To configure
a custom runtime, you replace this line in your
with this line:
You must also add a Dockerfile in the same directory that contains the
For building Python containers, Google provides this base image:
|Base Image||Version||Health Checks||Supports App Engine APIs||Notes|
||Python2.7/3.7||No||No||This is the same image used when you specify
See this example Dockerfile to replicate the standard runtime setup.
App Engine API support
A base image that supports the App Engine APIs supports 7 APIs in the standard (
runtime: python27) App Engine runtime.
By default, all programs running in the flexible environment receive health check requests. If a base image supports health checking, you don't need to write any additional code. If it does not, you will need to disable health checks, or write your own code to handle health check requests.
Selecting the Python version
You can specify a whether to use Python 2 or Python 3 in your application's
Dockerfile when creating the virtualenv:
# Python 3 RUN virtualenv /env -p python3.7 # Python 2 (implicit) RUN virtualenv /env # Python 2 (explicit) RUN virtualenv /env -p python2.7