I have a website deployed using docker image inside google compute instance.
I'm unable to update the google cloud instance with a new image. Updating the compute instance with new docker image and running the container changes nothing.
Here are the steps I take to update the google compute instance:
docker build -t vue_app -f deploy/web/Dockerfile . --tag gcr.io/namesapi-1581010760883/vue-app:v1
docker push gcr.io/namesapi-1581010760883/vue-app:v1
gcloud compute instances update-container --container-image=gcr.io/namesapi-1581010760883/vue-app:v1 vue-app-vm
So in the first line I build the image containing the website and http-server. I ran it locally and can confirm the image is working and contains all the changes I expect.
Next line is pushing the image to google cloud and the final third line is supposed to update an existing google compute instance with the new image.
After running this none of the changes are reflected in the instance. I visit the website hosted on the instance and see that nothing has changed. I've done these same steps many times and it all worked fine up until recently. What am I missing?
Solved the issue. For future reference running the following
gcloud compute instances update-container --container-image=gcr.io/namesapi-1581010760883/vue-app:v1 vue-app-vm
does not replace the existing image on the instance, instead it creates a new image. So after some time the instance accumulate a number of images:
REPOSITORY TAG IMAGE ID CREATED SIZE
gcr.io/namesapi-1581010760883/vue-app v1 d21bd8939323 9 days ago 394MB
gcr.io/namesapi-1581010760883/vue-app <none> c136b1c9e0d4 13 days ago 387MB
gcr.io/namesapi-1581010760883/vue-app <none> b1b11f2c9678 4 weeks ago 385MB
gcr.io/namesapi-1581010760883/vue-app <none> a5ef94db2438 4 weeks ago 385MB
gcr.io/namesapi-1581010760883/vue-app <none> 23b52253c060 6 weeks ago 385MB
gcr.io/namesapi-1581010760883/vue-app <none> cb03925836a7 2 months ago 384MB
gcr.io/gce-containers/konlet v.0.9-latest da64965a2b28 19 months ago 73.4MB
gcr.io/stackdriver-agents/stackdriver-logging-agent 0.2-1.5.33-1-1 fcfafd404600 22 months ago 548MB
I think what happened in my case was the compute instance ran out of disk space and new image was not pushed when running the above command. Google cloud API did not raise a warning or anything, which is why this was tricky to understand.
Solved this by logging into the instance manually and removing old images, then repeating the steps in the original question.