You can specify a container image in an instance template.
By default, Compute Engine also includes in the template a Container Optimised OS image with Docker installed.
When you use the template to create a new instance, the container is launched automatically as the instance starts up.
-
Go to the Instance Templates page.
-
Click Create instance template.
-
In the Container section, select the Deploy a container image to this VM instance checkbox.
-
Specify the Container image to use.
-
For example, you can specify gcr.io/cloud-marketplace/google/nginx1:1.12 to select an NGINX 1.12 container image from Cloud Launcher.
-
If you use a container image from Docker Hub, always specify the full Docker image name. For example, specify the following image name to deploy an Apache container image: docker.io/httpd:2.4.
-
Optionally, click Advanced container options.
-
Click Create.