为什么我不能删除私有docker注册表(v2)中的图层?

six*_*ter 6 docker-registry

我刚刚成功地在独立模式下安装了docker-registry,我可以使用以下命令

curl -X GET http://localhost:5000/v2/
Run Code Online (Sandbox Code Playgroud)

得到正确的结果.

但是,当我使用时

curl -X DELETE http://localhost:5000/v2/<name>/blobs/<digest>
Run Code Online (Sandbox Code Playgroud)

删除一个图层,它失败了,我得到:

{"errors":[{"code":"UNSUPPORTED","message":"The operation is unsupported."}]}
Run Code Online (Sandbox Code Playgroud)

我使用docker hub的默认配置.我研究了官方配置但未能解决它.

我怎么能把它弄出来?

wil*_*onW 7

您必须在/etc/docker/registry/config.yml中添加参数delete:enabled:true

让它看起来像那样:

 version: 0.1
 log:
    fields:
        service: registry
 storage:
    cache:
        layerinfo: inmemory
    filesystem:
        rootdirectory: /var/lib/registry
    delete:
        enabled: true
 http:
    addr: :5000
Run Code Online (Sandbox Code Playgroud)

看看这里了解更多细节

或者通过在启动时向容器添加环境变量:

-e REGISTRY_STORAGE_DELETE_ENABLED=true
Run Code Online (Sandbox Code Playgroud)


Mar*_*app 5

要么使用:

REGISTRY_STORAGE_DELETE_ENABLED=true
Run Code Online (Sandbox Code Playgroud)

或定义:

REGISTRY_STORAGE_DELETE_ENABLED: "yes"
Run Code Online (Sandbox Code Playgroud)

在 docker-compose 中。