5
votes

What is the most cost effective way of running a single docker container on GCP? I have various simple scripts which I've packaged in images and which I'd like to move to GCP and run them as containers. From the docs Google Container engine is:

A Container Engine cluster is a group of Compute Engine instances running Kubernetes. It consists of one or more node instances, and a managed Kubernetes master endpoint. A container cluster is the foundation of a Container Engine application—pods, services, and replication controllers all run on top of a cluster.

This sounds like an overkill as I only need one Compute Engine instance with the docker toolchain installed and easy access to other cloud tools (e.g. SQL). I proceeded to provision a Compute Engine VM but then had to set up docker which felt like reinventing Google Container Engine.

EDIT: I found this which is in alpha stage as of now (2017-09-06): https://cloud.google.com/compute/docs/instance-groups/deploying-docker-containers

2

2 Answers

4
votes

The most cost effective way is to run a single VM that runs your container. You can run Google's Container-Optimized OS to run the container and add a startup script to start the container when the machine boots (this OS already has docker installed and is the OS used by default in Google Container Engine).

However, you get other benefits from running on top of Google Container Engine: health checking of your container (and optionally of your VM), the ability to later trivially scale up your application to multiple replicas, the ability to easily deploy new versions of your application, support for logging / monitoring, etc. You may find that the features provided by Google Container Engine are worth the extra overhead it adds to your single node.

0
votes

I would probably just set up a single node Container engine cluster.

This is pretty much the same thing as a compute engine instance anyway, and it's pretty cost effective. Especially if you find that you aren't fully using the hardware, you can just run a second docker image on the same container engine instance without paying anything extra for it.