Why can’t I delete a layer in my private docker registry(v2)?

You have to add the parameter delete: enabled: true in /etc/docker/registry/config.yml

make it look like that :

 version: 0.1
 log:
    fields:
        service: registry
 storage:
    cache:
        layerinfo: inmemory
    filesystem:
        rootdirectory: /var/lib/registry
    delete:
        enabled: true
 http:
    addr: :5000

take a look here for more details

Or by adding an environment var to the container on boot :

-e REGISTRY_STORAGE_DELETE_ENABLED=true