We are using instance group to run docker containers, and set up the instance template to use image as
us.gcr.io/my-project/my-image:latest
.
When we make any change to the docker image, we label it with latest
and run:
gcloud compute instance-groups managed rolling-action restart my-instance-group --region us-central1
.
This was working fine for the initial changes to the image, the instance group vms will pull new images and override previous images. But after more changes were made, it starts to give the error:
no space left on device
Essentially, GCP does not handle stale images, it will store the old image copy. But in the case of "rolling update to container-optimized vms", can we get a better automation handling for these use cases? We really don't want to ssh into the host and run docker image prune -a
every so often manually.
rolling-action restart
command to prune old images automatically will be ideal.