Paul Hodges
Paul Hodges

Reputation: 15246

Delete helm chart from *registry* (not uninstall from cluster; not repository)

Helm v3 supports OCI registries, such as (for example) the standard registry image as installed with docker run -dp 5000:5000 --restart=always --name registry registry as opposed to the more common v2 repositories.

I can push, pull, etc, but I don't see any simple way to delete an obsolete chart from the registry once it's there.

Anyone got a good suggestion?

Upvotes: 0

Views: 910

Answers (1)

BMitch
BMitch

Reputation: 263469

First, you need to be sure your registry allows the deletion API, there's an extra REGISTRY_STORAGE_DELETE_ENABLED option for that:

docker run -d --restart=unless-stopped --name registry \
  -e "REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/lib/registry" \
  -e "REGISTRY_STORAGE_DELETE_ENABLED=true" \
  -v "registry-data:/var/lib/registry" \
  -p "127.0.0.1:5000:5000" \
  registry:2

Then you can call the manifest delete API. Just note that this will delete all tags pointing to that manifest. If you want to delete a single tag without impacting other tags to the same manifest, my own regclient project includes a regctl tag rm command for deleting a single tag, along with other CLI's you may find useful for managing a local registry (similar projects include crane and skopeo but I'm not sure they offer tag deletion).

Once you delete a manifest, the registry itself will still have some underlying blobs that can be pruned with a periodic GC. This should be done when no writes are occurring on the registry:

docker exec registry /bin/registry garbage-collect /etc/docker/registry/config.yml --delete-untagged

Upvotes: 1

Related Questions