Skip to content - Docker images for python
Branch: master
Clone or download
Latest commit 48a77b5 Apr 8, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
builder Revert default python3 version to 3.6 (#215) Feb 2, 2019
perf_dashboard Update metrics script to use the latest bigquery client library (#169) Nov 14, 2017
python-interpreter-builder Update python to 3.6.8 and 3.7.2 defaulting to 3.7 - taketwo (#212) Jan 22, 2019
runtime-image explicitly run apt-get upgrade to get latest versions of packages (#217) Feb 6, 2019
scripts Fixing release script Apr 8, 2019
tests Revert default python3 version to 3.6 (#215) Feb 2, 2019
.coveragerc Add nox support for running tests, lint, coverage, and requirements c… Jun 23, 2017
.gitignore Add a way to run just the library install tests for the DPE Gardener … Jul 12, 2017
.travis.yml Add basic Python unified benchmark test Aug 29, 2016
CODEOWNERS add donmccasland to CODEOWNERS (#218) Feb 6, 2019 Updating readme with contributing and license information. Feb 25, 2016
LICENSE initial import Jun 2, 2014 Fixing doc to reflect correct base image Jan 30, 2019 Container Builder is now Cloud Build. Aug 19, 2018 Update python to 3.6.8 and 3.7.2 defaulting to 3.7 - taketwo (#212) Jan 22, 2019
cloudbuild.yaml Split the runtime release into an interpreter and a runtime build. May 17, 2018
cloudbuild_benchmark.yaml Separate building and testing phases via --build and --test flags. Oct 20, 2017
cloudbuild_client_test.yaml Test cleanups and fixes (#179) Feb 26, 2018
cloudbuild_interpreters.yaml Add support for Python 3.7. Nov 5, 2018
cloudbuild_test.yaml Update python to 3.6.8 and 3.7.2 defaulting to 3.7 - taketwo (#212) Jan 22, 2019 Add support for Python 3.7. Nov 5, 2018

Google Cloud Platform - Python Runtime Docker Image

This repository contains the source for the docker base image. This image can be used as the base image for running applications on Google App Engine Flexible, Google Kubernetes Engine, or any other Docker host.

This image is based on Ubuntu Xenial and contains packages required to build most of the popular Python libraries. For more information about this runtime, see the documentation.

App Engine

When using App Engine Flexible, you can use the runtime without worrying about docker by specifying runtime: python in your app.yaml:

runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app

  # You can also specify 2 for Python 2.7
  python_version: 3

If you have an existing App Engine application using this runtime and want to customize it, you can use the Cloud SDK to create a custom runtime:

gcloud beta app gen-config --custom 

You can then modify the Dockerfile and .dockerignore as needed for you application.

Kubernetes Engine & other Docker hosts.

For other docker hosts, you'll need to create a Dockerfile based on this image that copies your application code, installs dependencies, and declares an command or entrypoint. For example:


# Create a virtualenv for dependencies. This isolates these packages from
# system-level packages.
# Use -p python3 or -p python3.7 to select python version. Default is version 2.
RUN virtualenv /env

# Setting these environment variables are the same as running
# source /env/bin/activate.
ENV PATH /env/bin:$PATH

# Copy the application's requirements.txt and run pip to install all
# dependencies into the virtualenv.
ADD requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt

# Add the application source code.
ADD . /app

# Run a WSGI server to serve the application. gunicorn must be declared as
# a dependency in requirements.txt.
CMD gunicorn -b :$PORT main:app

Building the image

Google regularly builds and releases this image at

See for more information.

Contributing changes


You can’t perform that action at this time.