Search code examples
google-cloud-platformgcloudgsutilgoogle-container-registrygoogle-artifact-registry

Google Artifact Registry: what's the alternative to artifacts.project-name.appspot.com?


With Google Container Registry, one could use gsutil to list Docker layers stored within the registry. For example, this command would calculate total size (I'm assuming that's the billable size) of stored layers:

gsutil du -hs gs://us.artifacts.project-name.appspot.com/containers/images

What's the alternative for this for Artifact Registry and pkg.dev?

I tried the python API and while I can retrieve image sizes with ListDockerImagesRequest, there's no information of how layers are used/shared. Is there a way to find total billable repository size for Artifact Registry?


Solution

  • For AR, you can use ListFiles to get all files in a repository. The repository size is just the sum of these file sizes and this will work for all repository types. (for docker, "Files" includes both manifests and layers)

    Api docs for ListFiles are here: https://cloud.google.com/artifact-registry/docs/reference/rpc/google.devtools.artifactregistry.v1beta2#listfilesrequest ("Parent" here is the repository. I will look into making this more clear in the docs)