[ Getting Started ]

Deploying Container on GCE

Author/Charlie|Editor/Anni, Bonni

[ Getting Started ] Deploying Container on GCE

Author/Charlie|Editor/Anni, Bonni

Are you wondering how to manage containers and managed instance groups in your familiar IaaS environment without costing extra resources or making repetitive steps of establishment over and over again? You can work with Docker Run, Docker Compose, Kubernetes, or simply choose a simpler and easier way by dropping the container image on GCE. After following our tutorial, you will find that deploying container on GCE only takes few minutes!


  • Check Container, you will find Boot Disk automatically replaced with Container-Optimized OS.
  • Provide container image name: if it is not a public image, you can push it to GCS or Google Cloud Container Builder (Both require the Google Cloud SDK installed).

Pushing Your Image

$ docker build -t ///: -f ./Dockerfile .

$ docker build -t us.gcr.io/hello-gcp/hello-gcp/myapp:0.1.13b -f ./Dockerfile .
The hostname of “gcr.io” can be decided according to the region.
  • us.gcr.io hosts your images in the United States
  • eu.gcr.io hosts your images in the European Union
  • asia.gcr.io hosts your images in Asia
  • gcr.io without a prefix hosts your images in the United States, but this behavior may change in a future release


$ gcloud docker -- push ///:

$ gcloud docker -- push us.gcr.io/hello-gcp/hello-gcp/myapp:0.1.13b


Cloud Container Builder

$ gcloud container builds submit -t ///: .

$ gcloud container builds submit -t us.gcr.io/hello-gcp/hello-gcp/myapp:0.1.13b .


Set Up

  • Revise in accordance with your requirements (in the red box).
  • Check Run as privileged if you require -privileged, -cap-add or -cap-drop.
  • Get Started!


  • In the above implementation, container and Host OS Port are one-to-one mapping. It doesn’t require additional setting.
  • Please set up your VPC network Firewall rules if it is public service.
  • All traffic of the instance will be forwarded to Host OS over the connection with SSH.
  • Docker can give commands to the container over the connection.
  • “Docker logs” is not available for now so you can use “Docker attach container-id” instead.

Read More

About CloudMile

成立於 2016 年,致力於 B2B 雲端與人工智慧應用,為客戶建立國際級雲端架構,並以機器學習及大數據分析技術為核心,協助企業進行商業預測與產業升級。

Website: https://www.mile.cloud/
Facebook: https://www.facebook.com/CloudMileFans/
Linkedin: https://www.linkedin.com/company/cloudmile/
Youtube: https://www.youtube.com/c/CloudMile
Contact Us: service@mile.cloud