Google App Engine on Docker for Development

If you like to use docker for development and you want to run google app engine as a container here is a short tutorial.

This example uses google app engine for python.

Docker Image

First of all we need a Dockerfile to describe the image:

The Dockerfile should be saved on the root of your project, but don’t name it just Dockerfile otherwise app engine will try to run a container. We will name it project_dockerfile.

Now, from the root of our project, we can build an image out of the Dockerfile:

docker build -t project_image -f project_dockerfile .

Run the container

To run a container based on the freshly built image:

docker run -d -v ${PWD}:/usr/share/app -p 8080:8080 -p 8000:8000 --name=project

tells docker to run in daemon mode

-v ${PWD}:/usr/share/app

mounts the current folder to the container’s /usr/share/app folder

-p 8080:8080 -p 8000:8000

forwards the 8080 and 8000 ports to the host 8080 and 8000 ports

Install python dependencies

If you need to install python dependencies and your project has a requirements.txt file,

connect to the running container

docker exec -it project /bin/bash

cd to the application folder

cd /usr/share/app

install the dependencies

pip install -r requirements.txt -t lib

and exit


Monitor the application

Of course we want to read the applications log as we test it, we can do this by “attaching” to the running container:

docker attach project

as soon as the application logs we will see it on the console

But.. where is the application?

If you point your browser to you should find your application running. is the address to the google app engine’s administrative console


Google app engine saves the application data to /usr/share/app/.data. Since this is mounted from the project root folder on our host, we will find the .data folder there as well.

This allows the google app engine to find the application data again after the container is stopped and restarted.