Google Compute Engine – Running Multiple Containers on VM Instances

dockergoogle-compute-engine

Looking at the Google Compute Engine documentation it states that "You can only deploy one container for each VM instance."

However, in the Getting started with Cloud Endpoints for Compute Engine with ESP tutorial it describes running two containers, one for the ESP and one for the API.

The tutorial documents doing this by hand so is not exactly a blueprint for production but it seems odd to me that this approach should be presented given the aforementioned limitation.

The fact that you can only specify one container in the gce-container-declaration means that to automate deploying multiple containers you'd need to use another approach.

Indeed elsewhere in the Container Optimized OS documentation it states:

"For advanced scenarios where you can deploy multiple containers and configure Docker options using cloud-init, you can create a Compute Engine instance with your choice of Container-Optimized OS image then proceed to configure it as needed."

Given this apparent inconsistency in the documentaion, is it viable to run multiple containers on GCE COS or should I be looking at other options such as Kubernetes?

Best Answer

It is possible to deploy multiple containers to Container Optimised OS but it's complicated procedure.

To quote again the documentation:

For advanced scenarios where you can deploy multiple containers and configure Docker options using cloud-init...

If you use console or deployment manager it's not possible to deploy more than one container, but if you create a config file and use cloud init you can deploy many containers to that instance.

I would recommend using GKE for that - it was designed specifically for that purpose and you can manage the containers in a much easier way.