我正在尝试根据本文创建一个私有存储库:https://www.codeproject.com/Articles/1263817/How-to-Setup-Our-Own-Private-Docker-Registry
我的平台是Windows 10,并且在桌面上使用docker。
但是当我推送到我的私人房间时遇到了这个错误:
>docker push localhost:5000/my-alpine
The push refers to repository [localhost:5000/my-alpine]
a464c54f93a9: Retrying in 1 second
received unexpected HTTP status: 500 Internal Server Error
这是
time="2019-06-22T13:57:07.4534462Z" level=error msg="response completed with error" err.code="blob unknown" err.detail=sha256:bdf0201b3a056acc4d6062cc88cd8a4ad5979983bfb640f15a145e09ed985f92 err.message="blob unknown to registry" go.version=go1.11.2 http.request.host="localhost:5000" http.request.id=8c71d5fa-41f1-49e4-9cab-2042e2cef0fa http.request.method=HEAD http.request.remoteaddr="172.30.80.1:1657" http.request.uri="/v2/my-alpine/blobs/sha256:bdf0201b3a056acc4d6062cc88cd8a4ad5979983bfb640f15a145e09ed985f92" http.request.useragent="docker/18.09.1 go/go1.10.6 git-commit/4c52b90 os/windows arch/amd64 UpstreamClient(Docker-Client/18.09.1 \(windows\))" http.response.contenttype="application/json; charset=utf-8" http.response.duration=2.6325ms http.response.status=404 http.response.written=157 vars.digest="sha256:bdf0201b3a056acc4d6062cc88cd8a4ad5979983bfb640f15a145e09ed985f92" vars.name=my-alpine
172.30.80.1 - - [22/Jun/2019:13:57:07 +0000] "HEAD /v2/my-alpine/blobs/sha256:bdf0201b3a056acc4d6062cc88cd8a4ad5979983bfb640f15a145e09ed985f92 HTTP/1.1" 404 157 "" "docker/18.09.1 go/go1.10.6 git-commit/4c52b90 os/windows arch/amd64 UpstreamClient(Docker-Client/18.09.1 \\(windows\\))"
172.30.80.1 - - [22/Jun/2019:13:57:07 +0000] "POST /v2/my-alpine/blobs/uploads/ HTTP/1.1" 500 258 "" "docker/18.09.1 go/go1.10.6 git-commit/4c52b90 os/windows arch/amd64 UpstreamClient(Docker-Client/18.09.1 \\(windows\\))"
time="2019-06-22T13:57:07.8604305Z" level=error msg="response completed with error" err.code=unknown err.detail="filesystem: truncate /var/lib/registry/docker/registry/v2/repositories/my-alpine/_uploads/8e29f389-ebd5-4d6f-ba80-7be8315c6311/startedat: permission denied" err.message="unknown error" go.version=go1.11.2 http.request.host="localhost:5000" http.request.id=b3de21ad-7b97-4560-8987-84ff62aecb9b http.request.method=POST http.request.remoteaddr="172.30.80.1:1660" http.request.uri="/v2/my-alpine/blobs/uploads/" http.request.useragent="docker/18.09.1 go/go1.10.6 git-commit/4c52b90 os/windows arch/amd64 UpstreamClient(Docker-Client/18.09.1 \(windows\))" http.response.contenttype="application/json; charset=utf-8" http.response.duration=100.4211ms http.response.status=500 http.response.written=258 vars.name=my-alpine
是否有解决此问题的意见? 仅当我处于 Windows容器模式时才观察到此问题。当我切换到 Linux容器模式时,一切正常!
答案 0 :(得分:1)
答案 1 :(得分:0)
如果您设置了安全的注册表,则需要使用以下方式登录到Docker注册表:
docker login --username=yourusername --email=email@domain.com:5000
然后您就可以
docker push localhost:5000/my-alpine
此外,从gitBash
中检查您是否正在使用curl
尝试:
curl -X GET https://myregistry:5000/v2/_catalog
您可能需要将username:pass
与curl
组合使用。当然,请务必检查您是否在Docker注册表容器中运行或退出。
答案 2 :(得分:0)
我遇到了同样的问题-能够推送linux映像,但是推送任何Windows映像都会产生相同的500:内部服务器错误。我通过禁用验证来使其工作,如此处所示:https://github.com/docker/distribution/issues/2232
您可以在命令行上将-e REGISTRY_VALIDATION_DISABLED=true
传递给docker run,或将REGISTRY_VALIDATION_DISABLED: 'true'
添加到docker-compose.yaml的Registry-> environment部分。
示例:
docker run -d -e REGISTRY_VALIDATION_DISABLED=true registry:latest
或在docker-compose.yaml中:
registry:
image: registry:latest
environment:
REGISTRY_VALIDATION_DISABLED: 'true'