Where docker gcloud images should build from

I read here that I can use gcloud

sdk to instantiate from container image. Here's how they say for nginx.

gcloud alpha compute instances create-from-container nginx-vm \
    --docker-image=gcr.io/google-containers/nginx:latest \
    --port-mappings=80:80:TCP

      

I would like to do this with a node image I made. I can run it locally with docker run -p 49160:8080 -d myusername/node-web-app

, but I don't understand where the image is. Is it an idea that I can just copy the image to the VM I run on cloud computing and then use a snippet like the one above? How can I find this image to do this? This question indicates that they are located at /Users/MyUserName/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2, the list doesn't look very promising there:

- .
- ..
- Docker.qcow2
- console-ring
- console-ring.0
- console-ring.1
- console-ring.2
- console-ring.3
- console-ring.4
- console-ring.5
- hypervisor.pid
- lock
- log
- mac.0
- nic1.uuid
- pid
- syslog
- tty -> /dev/ttys000

      

Is this the right way to build from a container in Cloud Compute? If so, where are the images from which the application should be built?

+3


source to share


1 answer


I don't understand where the image is.

It resides in your local docker store (which can be served by a local registry service , but you don't need it here)

Is the idea that I can just copy the image to the virtual machine that I run on the cloud calculates the command " gcloud alpha compute instances create-from-container

".

Not really: the idea is that you can set up a local image to the google cloud services registry service: see GCP: Pushing and Pulling Images "



Once the image is clicked, you can use the " gcloud alpha compute instances create-from-container

" command .

Therefore, you don't need to know exactly where your image is stored locally.
You only need:

  • Tag your image by running the following Docker command:

    docker tag [IMAGE] [HOSTNAME]/[YOUR-PROJECT-ID]/[IMAGE]
    
          

  • push the image into the Container Registry by running the following command:

    gcloud docker -- push [HOSTNAME]/[YOUR-PROJECT-ID]/[IMAGE]
    
          

+6


source







All Articles