This repository has been archived by the owner on Apr 18, 2023. It is now read-only.
Figure out how to delete stale containers created during deployment #61
Labels
enhancement
New feature or request
Right now, I have a "Delete object / 7+ days since object was created" lifecycle rule on the
us.artifacts.<project-id>.appspot.com
bucket. This seems to keep storage costs down, but I saw confusing file-not-found Cloud Build errors during deployment yesterday. Deploying worked again after I went to Container Registry in the console and manually deleted all theapp-engine-tmp
containers. I'm guessing that the containers contained stale references to GCS objects that had been deleted by the lifecycle rule.I have no idea what the right way is to clean up this junk. http://www.theappliedarchitect.com/what-the-heck-are-these-cloud-storage-buckets/ describes various buckets that get created, but it claims that you can just clean them up with lifecycle rules like I'm already doing (backed up by a stale link to a GCP documentation page).
I was thinking I could maybe write a script to delete old containers via
gcloud container images
, but I haven't figured out how to do it. I gave my dev user the "Storage Object Admin" permission on the GCS bucket, which prevents aERROR: (gcloud.container.images.list) Access denied
error, but I don't know how to list the individual images. (Note also that you need to pass--repository=us.gcr.io/<project-id>
since otherwise it'll try to querygcr.io
.)For example, I see two images listed in the console, but I don't know how to list them using the CLI:
There's a script linked from https://stackoverflow.com/a/67402286, but it seems like it's just doing the same thing that I tried.
The text was updated successfully, but these errors were encountered: