Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to directly deploy a container from docker hub to google compute engine?

When you create an instance on google compute engine there is an option to "Deploy a container image to this VM instance", which if you select asks for a container image

In the box for the container image it says "for example, gcr.io/google-containers/busybox" and clicking on the question mark next to the words "Container image" brings up "Name of a public image on any registry, or a private image hosted on Google Container Registry."

From this I infer that I can deploy an image directly from docker hub without needing to first upload it to the google container repository. However, I am having trouble with how I am supposed to direct the instance to the desired image.

For example if the image is username/repo:tag, I have tried putting username/repo or username/repo:tag as the container image, but when I load up the instance I am not in the container and the image isn't even listed on the docker images -a

What address should I be using?

like image 299
Michoel Snow Avatar asked Jun 15 '18 19:06

Michoel Snow


People also ask

Does GCP support Docker containers?

Another great benefit of Docker is the level of support for containers on Cloud platforms, such as Google Cloud (GCP), which we will be using in this article. We can quickly build an application, package it into a container with Docker, and deploy it across the globe with GCP.

Where can Docker containers be run in GCP?

You can run containers on Linux or Windows Server public VM images, or on a Container-Optimized OS image. Containers let your apps run with fewer dependencies on the host virtual machine (VM) and run independently from other containerized apps that you deploy to the same VM instance.


2 Answers

Yes, you may deploy an image directly from the docker hub.

When creating an instance in GCE, in the Container Image text box, you have to type the full path of the docker hub repository.

For instance, for the nginx public docker image, the container image that you should type is registry.hub.docker.com/library/nginx

The registry path for any official docker hub image should be written in the following way: registry.hub.docker.com/library/image.

For a private docker image, the container image that you should type is registry.hub.docker.com/username/repo or registry.hub.docker.com/username/repo:tag.

like image 103
Mahmoud Sharif Avatar answered Oct 19 '22 11:10

Mahmoud Sharif


docker.io/<username>/<repo>:<tag> works as well. Of course it points to the same registry as registry.hub.docker.com, but the pattern nicely matches gcr.io/<username>/<repo>:<tag>.

like image 40
Ernesto Elsäßer Avatar answered Oct 19 '22 09:10

Ernesto Elsäßer