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/<name>/manifests/<reference>
name:镜像名称
reference: 镜像对应sha256值
注意获取的请求头中需要加
Accept: application/vnd.docker.distribution.manifest.v2+json
获取镜像的digest的api
/v2/<镜像名称>/manifests/<tag>
这个接口只删除了元数据,并没有垃圾回收
进行容器执行垃圾回收命令:
registry garbage-collect config.yml
网友评论