Learning to Deploy with Google Container Engine

July 23rd, 2017

A predominantely self-taught application developer learns to deploy with Google Container Engine.


As a growth engineer, I spend most of my time within the application code and not infrastructure. Recently, Sentry moved to Google Cloud Platform and, as part of that, I’ve helped to set up our analytics infrastructure. I’ve played around with DigitalOcean, Linode, and AWS in the past, but my brief experience with GCP was excellent.

  1. Sentry’s core competency is infrastructure. My work has always been an incredibly motivating and free way to learn valuable skills.
  2. Docker and container technologies have stabilized and seem the way of the future. Most notably, Matt, our self-proclaimed old-man engineer, has given it a nod as “not a waste of time.”
  3. I have a side project that I’d like to deploy. Relearning Supervisor or whatever other technology seems less useful than Docker.

Getting Started

I started with Docker’s tutorial in getting running locally.

My Dockerfile was pretty straightforward. Choosing between the various Python container, I landed on onbuild because it automatically builds your requirements.txt, though alpine is generally recommended.

FROM python:3.6-onbuild
COPY app.py /app
CMD ["python", "app.py"]

Next up was Google’s Container Engine tutorial. They take you through a standard hello-node, but I wanted to build one from scatch.

It’s important that your docker image name is the url of the image registry. It defaults to Docker’s public registry, but if you’re using Google’s private Container Registry, you need to name is something like gcr.io/${PROJECT_ID}/hello-python. Alternatively, you can use Docker’s registry to host it.

Successfully uploaded to GCR!

If you want to use Google’s UI for creating a cluster, you can still manipulate it from cli by first:

gcloud container clusters get-credentials <CLUSTER_NAME>

After that, it was a simple sed of node for python in the directions, and I had something running!

Next up: hooking it up with a database.