docker registry 私有仓库 安装配置、查询、删除
#++++++++++++++++++++++++++++++#docker-registry 私有仓库#搜索,下载register镜像docker search registrydocker pull registrydocker images#创建容器registrymkdir -p /www/docker/registrydocker run --name registry --restart=always -p 5000:5000 -v /www/docker/registry:/var/lib/registry -d registrydocker ps -l#镜像仓库地址使用域名echo '127.0.0.1 hub.test.com'>>/etc/hosts#修改tag (以hello-world为例)docker push hello-worlddocker tag hello-world hub.test.com:5000/hello-world:1.0#上传、删除、再下载镜像,删除后能下载成功docker imagesdocker push hub.test.com:5000/hello-world:1.0docker rmi hub.test.com:5000/hello-world:1.0docker imagesdocker pull hub.test.com:5000/hello-world:1.0docker images#查看仓库镜像curl hub.test.com:5000/v2/_catalog#++++++++++++++++++++++++++++++#registry开启删除#查看默认配置docker exec -it registry sh -c 'cat /etc/docker/registry/config.yml'#开启删除(添加 delete: enabled: true)docker exec -it registry sh -c "sed -i '/storage:/a\ delete:' /etc/docker/registry/config.yml"docker exec -it registry sh -c "sed -i '/delete:/a\ enabled: true' /etc/docker/registry/config.yml"#重启docker restart registry#查询、删除镜像#查询镜像curl <仓库地址>/v2/_catalog#查询镜像tag(版本)curl <仓库地址>/v2/<镜像名>/tags/list#删除镜像APIcurl -I -X DELETE "<仓库地址>/v2/<镜像名>/manifests/<镜像digest_hash>"#获取镜像digest_hashcurl <仓库地址>/v2/<镜像名>/manifests/<tag> --header "Accept: application/vnd.docker.distribution.manifest.v2+json" # 为方面使用,写了个shell脚本#详情 http://www.cnblogs.com/elvi/p/8384675.html#默认查询 -h #帮助 -d #删除#++++++++++++++++++++++++++++++#没配置https,非本机,需要配置安全地址才能使用#docker私有仓库设置(hub.test.com:5000替换为自己的地址)SetOPTS=" --insecure-registry hub.test.com:5000"sed -i "s#^ExecStart.*#& $SetOPTS #" /usr/lib/systemd/system/docker.servicegrep 'ExecStart' /usr/lib/systemd/system/docker.service#重启dockersystemctl daemon-reloadsystemctl restart docker#++++++++++++++++++++++++++++++
赞 (0)