docker registry 镜像删除

kevin.Zhu 发布于:2018-5-6 15:43 分类:文摘  有 29 人浏览,获得评论 0 条  

https://blog.csdn.net/l6807718/article/details/52886546

https://blog.csdn.net/ismr_m/article/details/53023515


1) 更改registry容器内/etc/docker/registry/config.yml文件

storage: delete: enabled: true

2)重启registry

3) 拿到digest_hash参数

curl --header "Accept: application/vnd.docker.distribution.manifest.v2+json" -I -X GET http://<仓库地址>/v2/<镜像名>/manifests/<tag>

返回示例:

HTTP/1.1 200 OK
Content-Length: 529
Content-Type: application/vnd.docker.distribution.manifest.v2+json
Docker-Content-Digest: sha256:15dc436f352be3a0aed4d642a2589b1eee7602fbe8a4d605363eb991e3aeb2ea
Docker-Distribution-Api-Version: registry/2.0
Etag: "sha256:15dc436f352be3a0aed4d642a2589b1eee7602fbe8a4d605363eb991e3aeb2ea"
X-Content-Type-Options: nosniff
Date: Sun, 06 May 2018 07:27:37 GMT

4) 删除

curl -X DELETE /v2/<name>/manifests/<reference>

如果没有任何信息返回,表示成功删除