No repositories directory found inside registry_ DATA_ DIR

No repositories directory found inside registry_ DATA_ DIR

Registry uses delete_ docker_ registry_ Solution 1: modify the global configuration file solution 2: modify the third-party plug-in

Registry uses delete_ docker_ registry_ Image delete image

Delete the specified image:
/usr/local/bin/delete_ docker_ registry_ Image - I image name delete the specified image label:
/usr/local/bin/delete_ docker_ registry_ Image - I image name: label

Delete error

REGISTRY_ DATA_ Dir is the directory corresponding to the private library file mapped to the local volume

[root@bigdata ~]# delete_docker_registry_image --image ssh-web-console:latest
No repositories directory found inside REGISTRY_DATA_DIR /opt/registry_data/docker/registry/v2

Solution 1: modify the global configuration file

This method is suitable for using delete on the server_ docker_ registry_ Image three party plug-in for image deletion of docker private library

[root@bigdata ~]# vim /etc/profile
'''
export REGISTRY_DATA_DIR=/data/docker/registry/docker/registry/v2
"/etc/profile" 86L, 2182C 

Solution 2: modify the third-party plug-in

This method is applicable to the server, and it is also applicable to delete when calling shell command with background service_ docker_ registry_ Image three party plug-in for image deletion of docker private library

[root@bigdata ~]# vim /usr/local/bin/delete_docker_registry_image
'''
	if 'REGISTRY_DATA_DIR' in os.environ:
        registry_data_dir = os.environ['REGISTRY_DATA_DIR']
    else:
        registry_data_dir = "/root/data/registry/docker/registry/v2"//Here is the path to your own mirror repository
 
    try:
        cleaner = RegistryCleaner(registry_data_dir, dry_run=args.dry_run)
        if args.untagged:
            cleaner.delete_untagged(image)
        else:
            if tag:
                cleaner.delete_repository_tag(image, tag)
            else:
                cleaner.delete_entire_repository(image)
 
        if args.prune:
            cleaner.prune()
    except RegistryCleanerError as error:
        logger.fatal(error)
        sys.exit(1)
 
 
if __name__ == "__main__":
    main()

Read More: