0

Thank you for taking the time to read this.

We have a build trigger connected to our bitbucket repo that creates a docker container of our server and stores it as an image in the Container Registry on the Google Cloud Console.

We also have a Virtual Machine instance created under the Compute Engine that references this image. In general, all of this works fine. We are able to run our application as a docker container on this VM. We can connect to it remotely no problem.

In order to help streamline our process, we wanted the build trigger to force the VM to reset so that it would always be running the most up to date version of the docker container.

We did this by creating a Cloud Function. On the Topic:cloud-builds, we trigger a python script that resets our VM instance. We also know this works as whenever a build is completed we can see the VM reset within the VM logs.

The problem is that for some reason it does not always pick up the latest image. In fact, sometimes doing a manual reset on the VM does not do it. A number of resets (2 to 3) are required before the new container image shows up.

Is there something wrong with our approach for trying to do this? Or is there a certain amount of time (a minute or so) that has to pass before the new container image is available to be used within a VM instance?

Thank you again.

  • Can you post some more information about the build process (in particular how the image is built / pushed and how the topic is triggered). My guess is that you have a race condition where something is pushed to the topic before the image push is done, potentially restarting the instance before the image is available. – Andy Shinn Sep 03 '19 at 00:34
  • How are the pods being pulled and How does the image update process work for the VM? You mentioned that you are doing this with a cloud trigger? Is the [trigger functioning](https://cloud.google.com/functions/docs/monitoring/logging) well? – Milad Tabrizi Sep 04 '19 at 00:20

0 Answers0