4

Im using the Google Container OS on Compute Engine, and Im using the web UI to start a single container.

How do I restart the container with the same env and flags when I have pushed a new image?

I can SSH into the machine and pull the new image, but when I docker restart it uses the old image.

If I just re-run the new image I am missing the env and flags.

How do I run the new image with the env and flags provided in the web console without a reboot?

Thanks

zino
  • 1,222
  • 2
  • 17
  • 47
  • I hope this doesn't come across badly. Why is it important to restart the container inside the compute engine without rebooting the compute engine? If I read the docs here ... https://cloud.google.com/compute/docs/containers/deploying-containers#updating_a_container_on_a_vm_instance it seems that when one updates state through the cloud console, the instance is restarted (rebooted). – Kolban Apr 25 '20 at 05:01
  • It takes about 3 minutes to restart the VM vs around 5 seconds for the container. I am making small iterations to my code as I am moving it from my dev machine to the prod VM, im discovering subtle differences in the environments that need code changes. – zino Apr 25 '20 at 12:07

1 Answers1

4

The Google Container OS leverages an open-source bootstrap component called Konlet. This can be read about here. If you desire to restart/reload your container, here is a recipe:

  1. Login to the Linux GCE instance using SSH
  2. Stop your docker container
  3. Delete your docker container instance
  4. Run sudo systemctl start konlet-startup

The service (konlet-startup) will do the job of creating a new Docker container instance using the metadata (configuration) that you have defined.

Kolban
  • 13,794
  • 3
  • 38
  • 60
  • Thanks sir that did the trick. `gcloud beta compute ssh --zone "europe-west1-b" --project "proj" --command "sudo systemctl start konlet-startup" "instance-name"` works well – zino Apr 25 '20 at 21:30