burnettk / delete-docker-registry-image

If you are running a private v2 docker registry, and you are storing your data on disk, running this script from the machine where the data lives will let you fully delete an image or tag

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to set the "REGISTRY_DATA_DIR"

aamagzoub opened this issue · comments

Hi,

I have a machine hosting the running docker registry and it is working fine except for deleting. So, I downloaded your script and gave it the proper permission.

Based on the configuration of my registry inside the docker-compose.yaml file, the volume in my container is set as follow:
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data

After running the registry, the above volume corresponds to the following path in my local machine /var/lib/docker/volumes/registry_registrydata/_data/docker/registry/v2/repositories
which contains the following directories:

  • blobs
  • repositories

Then, following your instructions, I set the REGISTRY_DATA_DIR to the above local path. i.e.:
/var/lib/docker/volumes/registry_registrydata/_data/docker/registry/v2/repositories

Now, when I run the following command:
delete_docker_registry_image --image project/ubuntu --dry-run

I get the following error:
No repositories directory found inside REGISTRY_DATA_DIR '/var/lib/docker/volumes/registry_registrydata/_data/docker/registry/v2/repositories'
what am I doing wrong?

Thank you

it sounds like you may need REGISTRY_DATA_DIR=/var/lib/docker/volumes/registry_registrydata/_data/docker/registry/v2 instead of REGISTRY_DATA_DIR=/var/lib/docker/volumes/registry_registrydata/_data/docker/registry/v2/repositories.

@burnettk , thanks for your reply.

But I tried that path you stated and it doesn't work either. In fact, I tried the all these paths:

  • /var/lib/docker/volumes/registry_registrydata/_data/docker/registry/v2/repositories (your suggestion)
  • /var/lib/docker/volumes/registry_registrydata/_data/docker/registry/v2 (my first try)
  • /volumes/registry_registrydata/_data/docker/registry/v2/repositories
  • /_data/docker/registry/v2/repositories/
  • /_data/docker/registry/v2/

But, non of them worked and I always get the error:
No repositories directory found inside REGISTRY_DATA_DIR '<path>'

It might helpful to explain in the READ-me what is this REGISTRY_DATA_DIR parameters refers to and how the code works to translate it

Why and how did I close this issue ?!
I am looking forward to any help please

i think you closed it. :) If you provide source code and steps to repro, someone might be able to figure out the issue.