docker配置文件 /etc/docker/daemon.json

insecure-registries

[root@hadoop03 k8s]# cat /etc/docker/daemon.json
{
        "registry-mirrors": ["https://registry.docker-cn.com"],
        "exec-opts": ["native.cgroupdriver=systemd"],
        "insecure-registries": ["hadoop03:5000"]
}

[hadoop@hadoop03 ~]$ curl hadoop03:5000/v2/_catalog
{"repositories":["busybox","coredns","etcd","flannel","gluster-centos","heketi","kube-apiserver","kube-controller-manager","kube-proxy","kube-scheduler","mirrored-flannelcni-flannel-cni-plugin","nginx","pause"]}

### 查看镜像版本
[hadoop@hadoop03 ~]$ curl -XGET hadoop03:5000/v2/coredns/tags/list
{"name":"coredns","tags":["v1.8.4"]}

### 
[root@hadoop03 hadoop]# curl  --header "Accept: application/vnd.docker.distribution.manifest.v2+json"anifests/latest
HTTP/1.1 200 OK
Content-Length: 1570
Content-Type: application/vnd.docker.distribution.manifest.v2+json
Docker-Content-Digest: sha256:ee89b00528ff4f02f2405e4ee221743ebc3f8e8dd0bfd5c4c20a2fa2aaa7ede3
Docker-Distribution-Api-Version: registry/2.0
Etag: "sha256:ee89b00528ff4f02f2405e4ee221743ebc3f8e8dd0bfd5c4c20a2fa2aaa7ede3"
X-Content-Type-Options: nosniff
Date: Thu, 27 Jan 2022 06:21:43 GMT


### 删除仓库镜像
[root@hadoop03 hadoop]# curl -I -X DELETE http://hadoop03:5000/v2/nginx/manifests/ee89b00528ff4f02f24de3
HTTP/1.1 405 Method Not Allowed
Content-Type: application/json; charset=utf-8
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff
Date: Thu, 27 Jan 2022 06:22:20 GMT
Content-Length: 78

[root@hadoop03 hadoop]# curl -I -X DELETE http://hadoop03:5000/v2/nginx/manifests/sha256:ee89b00528ff4f02f2405e4ee221743ebc3f8e8dd0bfd5c4c20a2fa2aaa7ede3
HTTP/1.1 405 Method Not Allowed
Content-Type: application/json; charset=utf-8
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff
Date: Thu, 27 Jan 2022 06:28:05 GMT
Content-Length: 78


[root@hadoop03 hadoop]# docker exec -it registry sh                                                  / # cat /etc/docker/registry/config.yml
version: 0.1
log:
  fields:
    service: registry
storage:
  cache:
    blobdescriptor: inmemory
  filesystem:
    rootdirectory: /var/lib/registry
  delete:    ### 新增
    enabled: true    ### 新增
http:
  addr: :5000
  headers:
    X-Content-Type-Options: [nosniff]
health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3
/ # exit

[root@hadoop03 hadoop]# docker stop registry
registry
[root@hadoop03 hadoop]# docker start registry
registry
[root@hadoop03 hadoop]# curl -I -X DELETE http://hadoop03:5000/v2/nginx/manifests/sha256:ee89b00528ff4f02f2405e4ee221743ebc3f8e8dd0bfd5c4c20a2fa2aaa7ede3
HTTP/1.1 202 Accepted
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff
Date: Thu, 27 Jan 2022 06:29:20 GMT
Content-Length: 0

转自:https://shipengliang.com/software-exp/docker-registry%E4%BB%93%E5%BA%93%E9%95%9C%E5%83%8F%E5%88%A0%E9%99%A4%E6%96%B9%E6%B3%95.html

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐