欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

docker操作私有仓库

程序员文章站 2024-03-12 23:56:27
...

docker操作私有仓库

  • 启动私有仓库

docker run -d --restart=always --name=registry -v /home/registry/config:/etc/docker/registry -v /home/registry/data:/var/lib/registry -p 5000:5000 registry

-设置可以删除镜像config.yml
storage:
delete:
enabled: true

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
  • 保存镜像

docker tag tomcat:7 127.0.0.1:5000/tomcat:7
docker push 127.0.0.1:5000/tomcat:7

  • 拉取镜像

docker pull 127.0.0.1:5000/tomcat:7

  • 获取镜像信息
    127.0.0.1:5000/v2/[img]/manifests/[version]

curl --header “Accept: application/vnd.docker.distribution.manifest.v2+json” -I -XGET 127.0.0.1:5000/v2/tomcat/manifests/7

HTTP/1.1 200 OK
Content-Length: 2625
Content-Type: application/vnd.docker.distribution.manifest.v2+json
Docker-Content-Digest: sha256:4777ae4742f1d23b0b3d8e0651ce87d28e9a765167747adcf0c112e37a6f7f6d
Docker-Distribution-Api-Version: registry/2.0
Etag: "sha256:4777ae4742f1d23b0b3d8e0651ce87d28e9a765167747adcf0c112e37a6f7f6d"
X-Content-Type-Options: nosniff
Date: Wed, 28 Nov 2018 08:08:00 GMT
  • 删除镜像

curl -XDELETE 127.0.0.1:5000/v2/tomcat/manifests/sha256:4777ae4742f1d23b0b3d8e0651ce87d28e9a765167747adcf0c112e37a6f7f6d

相关标签: docker 私有仓库