Can I delete container images from Google Cloud Storage artifacts bucket?
Jan 27
I have a Google App Engine app, which connects to Google Cloud Storage.
I noticed that the amount of data stored was unreasonably high (4.01 GB, when it should be 100MB or so).
So, I looked at how much each bucket was storing, and I found that there was an automatically created bucket called us.artificats. that was taking up most of the space.
I looked inside, and all it has is one folder: containers/images/.
From what I've Googled, it seems like these images come from Google Cloud Build.
My question is, can I delete them without compromising my entire application?
1 answer
Accepted answer · original discussion
Jan 28
For those of you seeing this later on, I ended up deleting the folder, and everything was fine.
When I ran Google Cloud Build again, it added items back into the bucket, which I had to delete later on.
As @HarshitG mentioned, this can be set up to happen automatically via deletion rules in cloud storage. As for myself, I added a deletion step to my deployment GitHub action.
3 question comments
Use comments to ask for clarification. Post a solution as an answer.
Jan 27
gcloud container images delete. A container consists of layers. You are seeing these layers as objects in Cloud Storage. Do not directly delete these objects. In simple terms, these objects are cached layers that are used to build a container image. For some tools if a layer is not cached it will first be pulled (downloaded), but I have not tried to deliberately delete container registry objects to see what happens.Jan 27
--repository=[HOSTNAME]/[PROJECT-ID] Repository locations are gcr.io, us.gcr.io, eu.gcr.io, and asia.gcr.io. Also review this document: cloud.google.com/container-registry/docs/managing