docker仓库删除镜像

docker registry镜像的配置文件地址:

/etc/docker/registry/config.yml

配置文件内容:

version: 0.1
log:
 fields:
 service: registry
storage:
 delete:
  enabled: true
 cache:
  blobdescriptor: inmemory
 filesystem:
  rootdirectory: /var/lib/registry
http:
 addr: :5000
 headers:
  X-Content-Type-Options: [nosniff]
health:
 storagedriver:
 enabled: true
 interval: 10s
 threshold: 3

删除镜像

删除镜像api:

DELETE /v2//manifests/
name:镜像名称
reference: 镜像对应sha256值

注意获取的请求头中需要加

Accept: application/vnd.docker.distribution.manifest.v2+json

获取镜像的digest的api

/v2/<镜像名称>/manifests/

这个接口只删除了元数据,并没有垃圾回收

进行容器执行垃圾回收命令:

registry garbage-collect config.yml

你可能感兴趣的:(docker仓库删除镜像)