Skip to content

Delete untagged image refs in Google Container Registry or Artifact Registry

License

Notifications You must be signed in to change notification settings

team-ruutly/gcr-cleaner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GCR Cleaner

Setup

  1. Install the [Cloud SDK][cloud-sdk] for your operating system. Alternatively, you can run these commands from [Cloud Shell][cloud-shell], which has the SDK and other popular tools pre-installed.

  2. Export your project ID as an environment variable. The rest of this setup assumes this environment variable is set.

    export PROJECT_ID="my-project"

    Note this is your project ID, not the project number or name.

  3. Enable the Google APIs - this only needs to be done once per project:

    gcloud services enable --project "${PROJECT_ID}" \
      appengine.googleapis.com \
      cloudscheduler.googleapis.com \
      run.googleapis.com

    This operation can take a few minutes, especially for recently-created projects.

Start removing unused images.

go run main.go -repo gcr.io/oceanic-hook-268813/repo-name -keep 3 --tag-filter-all . -recursive

  • Repo: Name of repo for which want to remove unused images
  • keep: no of images you dont want to be removed

About

Delete untagged image refs in Google Container Registry or Artifact Registry

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 95.8%
  • Dockerfile 2.6%
  • Makefile 1.6%