简体   繁体   English

Docker 无法将镜像推送到私有镜像仓库

[英]Docker cannot push image to private registry

I created a Freestyle Project on jenkins to deploy spring boot application using Docker Build and Publish.我在 jenkins 上创建了一个 Freestyle 项目,以使用 Docker 构建和发布来部署 spring 启动应用程序。 Moreover I created a secure private registry on same machine using https://www.codeproject.com/Articles/1263817/How-to-Setup-Our-Own-Private-Docker-Registry and https://www.codeproject.com/Articles/1263831/How-to-secure-your-private-Docker-Registry .此外,我使用https://www.codeproject.com/Articles/1263817/How-to-Setup-Our-Own-Private-Docker-Registryhttps://www.codeproject.com在同一台机器上创建了一个安全的私有注册表/Articles/1263831/How-to-secure-your-private-Docker-Registry

I got the following error from Jenkins:我从 Jenkins 收到以下错误:

received unexpected HTTP status: 500 Internal Server Error
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE

The registry logs are as following:注册表日志如下:

{"log":"time=\"2022-02-08T13:24:35.3479554Z\" level=error msg=\"response completed with error\" err.code=unknown err.message=\"unknown error\" go.version=go1.16.13 http.request.contenttype=\"application/vnd.docker.distribution.manifest.v2+json\" http.request.host=hub.docker http.request.id=798ba3fb-0471-4e76-b8c6-fa04b7cd5d6a http.request.method=PUT http.request.remoteaddr=\"xxx.xxx.xxx.xxx\" http.request.uri=\"/v2/docker-jenkins-integration-sample/manifests/latest\" http.request.useragent=\"docker/19.03.5 go/go1.12.12 git-commit/2ee0c57608 os/windows arch/amd64 UpstreamClient(Docker-Client/19.03.5 \\(windows\\))\" http.response.contenttype=\"application/json; charset=utf-8\" http.response.duration=\"999.5µs\" http.response.status=500 http.response.written=523 vars.name=docker-jenkins-integration-sample vars.reference=latest \n","stream":"stderr","time":"2022-02-08T13:24:35.8661829Z"}
{"log":"time=\"2022-02-08T13:24:35.3480004Z\" level=error msg=\"response completed with error\" err.code=unknown err.message=\"invalid URL on layer\" go.version=go1.16.13 http.request.contenttype=\"application/vnd.docker.distribution.manifest.v2+json\" http.request.host=hub.docker http.request.id=798ba3fb-0471-4e76-b8c6-fa04b7cd5d6a http.request.method=PUT http.request.remoteaddr=\"xxx.xxx.xxx.xxx\" http.request.uri=\"/v2/docker-jenkins-integration-sample/manifests/latest\" http.request.useragent=\"docker/19.03.5 go/go1.12.12 git-commit/2ee0c57608 os/windows arch/amd64 UpstreamClient(Docker-Client/19.03.5 \\(windows\\))\" http.response.contenttype=\"application/json; charset=utf-8\" http.response.duration=1.0451ms http.response.status=500 http.response.written=523 vars.name=docker-jenkins-integration-sample vars.reference=latest \n","stream":"stderr","time":"2022-02-08T13:24:35.8661829Z"}
{"log":"time=\"2022-02-08T13:24:35.3480222Z\" level=error msg=\"response completed with error\" err.code=\"manifest blob unknown\" err.detail=sha256:4612f6d0b889cad0ed0292fae3a0b0c8a9e49aff6dea8eb049b2386d9b07986f err.message=\"blob unknown to registry\" go.version=go1.16.13 http.request.contenttype=\"application/vnd.docker.distribution.manifest.v2+json\" http.request.host=hub.docker http.request.id=798ba3fb-0471-4e76-b8c6-fa04b7cd5d6a http.request.method=PUT http.request.remoteaddr=\"192.168.183.103:51762\" http.request.uri=\"/v2/docker-jenkins-integration-sample/manifests/latest\" http.request.useragent=\"docker/19.03.5 go/go1.12.12 git-commit/2ee0c57608 os/windows arch/amd64 UpstreamClient(Docker-Client/19.03.5 \\(windows\\))\" http.response.contenttype=\"application/json; charset=utf-8\" http.response.duration=1.0671ms http.response.status=500 http.response.written=523 vars.name=docker-jenkins-integration-sample vars.reference=latest \n","stream":"stderr","time":"2022-02-08T13:24:35.8661829Z"}
{"log":"time=\"2022-02-08T13:24:35.3481934Z\" level=error msg=\"response completed with error\" err.code=unknown err.message=\"unknown error\" go.version=go1.16.13 http.request.contenttype=\"application/vnd.docker.distribution.manifest.v2+json\" http.request.host=hub.docker http.request.id=798ba3fb-0471-4e76-b8c6-fa04b7cd5d6a http.request.method=PUT http.request.remoteaddr=\"xxx.xxx.xxx.xxx\ http.request.uri=\"/v2/docker-jenkins-integration-sample/manifests/latest\" http.request.useragent=\"docker/19.03.5 go/go1.12.12 git-commit/2ee0c57608 os/windows arch/amd64 UpstreamClient(Docker-Client/19.03.5 \\(windows\\))\" http.response.contenttype=\"application/json; charset=utf-8\" http.response.duration=1.2378ms http.response.status=500 http.response.written=523 vars.name=docker-jenkins-integration-sample vars.reference=latest \n","stream":"stderr","time":"2022-02-08T13:24:35.8661829Z"}
{"log":"time=\"2022-02-08T13:24:35.3483014Z\" level=error msg=\"response completed with error\" err.code=unknown err.message=\"invalid URL on layer\" go.version=go1.16.13 http.request.contenttype=\"application/vnd.docker.distribution.manifest.v2+json\" http.request.host=hub.docker http.request.id=798ba3fb-0471-4e76-b8c6-fa04b7cd5d6a http.request.method=PUT http.request.remoteaddr=\"xxx.xxx.xxx.xxx\" http.request.uri=\"/v2/docker-jenkins-integration-sample/manifests/latest\" http.request.useragent=\"docker/19.03.5 go/go1.12.12 git-commit/2ee0c57608 os/windows arch/amd64 UpstreamClient(Docker-Client/19.03.5 \\(windows\\))\" http.response.contenttype=\"application/json; charset=utf-8\" http.response.duration=1.2945ms http.response.status=500 http.response.written=523 vars.name=docker-jenkins-integration-sample vars.reference=latest \n","stream":"stderr","time":"2022-02-08T13:24:35.8661829Z"}
{"log":"time=\"2022-02-08T13:24:35.3483546Z\" level=error msg=\"response completed with error\" err.code=\"manifest blob unknown\" err.detail=sha256:567fd00846e9a9f44eea5925b497356dda00fe89b8335d2a3b2a8b9d84b0bb69 err.message=\"blob unknown to registry\" go.version=go1.16.13 http.request.contenttype=\"application/vnd.docker.distribution.manifest.v2+json\" http.request.host=hub.docker http.request.id=798ba3fb-0471-4e76-b8c6-fa04b7cd5d6a http.request.method=PUT http.request.remoteaddr=\"192.168.183.103:51762\" http.request.uri=\"/v2/docker-jenkins-integration-sample/manifests/latest\" http.request.useragent=\"docker/19.03.5 go/go1.12.12 git-commit/2ee0c57608 os/windows arch/amd64 UpstreamClient(Docker-Client/19.03.5 \\(windows\\))\" http.response.contenttype=\"application/json; charset=utf-8\" http.response.duration=1.3989ms http.response.status=500 http.response.written=523 vars.name=docker-jenkins-integration-sample vars.reference=latest \n","stream":"stderr","time":"2022-02-08T13:24:35.8661829Z"}
{"log":"xxx.xxx.xxx.xxx - - [08/Feb/2022:13:24:35 +0000] \"PUT /v2/docker-jenkins-integration-sample/manifests/latest HTTP/1.1\" 500 523 \"\" \"docker/19.03.5 go/go1.12.12 git-commit/2ee0c57608 os/windows arch/amd64 UpstreamClient(Docker-Client/19.03.5 \\\\(windows\\\\))\"\n","stream":"stdout","time":"2022-02-08T13:24:35.8661829Z"}

Setting like "max-concurrent-downloads": 1 is not worked."max-concurrent-downloads": 1不起作用。 How to solve the issue?如何解决这个问题?

EDIT编辑

I created the private registry by following command on powershell in Windows Server 2019我通过在 Windows Server 2019 中的 powershell 上执行命令创建了私有注册表

 docker run -d -p 443:443 --name hub.local -v C:/localhub/certs:/certs -v C:/localhub/registry:/var/lib/registry -e REGISTRY_HTTP_ADDR=0.0.0.0:443 -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/localhub.crt -e REGISTRY_HTTP_TLS_KEY=/certs/localhub.key registry

Jenkins setting are as below: Jenkins设置如下:

Jenkins settings Jenkins 设置

Given the invalid URL error and on the "windows" in the 500, I'm guessing it's a foreign layer for windows images that's getting rejected by validation.鉴于无效的 URL 错误和 500 中的“windows”,我猜测它是 windows 图像的外部层,被验证拒绝。 I tried figuring out the right syntax to allow that in the past and eventually gave up and turned off the validation with REGISTRY_VALIDATION_DISABLED=true .我曾尝试找出正确的语法以允许在过去使用并最终放弃并使用REGISTRY_VALIDATION_DISABLED=true关闭验证。 Eg here's a command I use to start a registry:例如,这是我用来启动注册表的命令:

docker run -d --restart=unless-stopped --name registry \
  -e "REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/lib/registry" \
  -e "REGISTRY_STORAGE_DELETE_ENABLED=true" \
  -e "REGISTRY_VALIDATION_DISABLED=true" \
  -v "registry-data:/var/lib/registry" \
  -p "127.0.0.1:5000:5000" \
  registry:2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 spring 引导项目中使用 gradle 将 docker 图像推送到远程注册表 - How to push a docker image to remote registry with gradle in a spring boot project Maven Spring Boot 无法推送 Docker 镜像 - Maven Spring Boot Cannot Push Docker Image 从 Spring 引导 POM 文件中删除私有 docker 注册表凭据 - Remove private docker registry credentials from Spring Boot POM file 使用“mvn compile jib:build”推送到 Docker Registry 失败 - Failure on Push to Docker Registry using 'mvn compile jib:build ' 将Docker映像推送到远程服务器 - Push docker image to remote server 无法通过IDE连接到Docker上的Jhipster Spring注册表 - Cannot connect to jhipster spring registry on docker via IDE 如何使用 Pulumi 配置 AWS ECS Fargate 任务/集群以访问私有 Docker 容器注册表(如 GitHub 容器注册表)? - How to configure AWS ECS Fargate Tasks/Cluster to access private Docker Container Registry (like GitHub Container Registry) with Pulumi? Docker Java Image无法连接到Docker Mongo - Docker Java Image cannot connect to Docker Mongo 将私有 buildpack 注册表与 spring-boot:build-image 一起使用的正确方法是什么? - What is the correct way to use a private buildpack registry with spring-boot:build-image? Azure Devops Docker 推送:本地不存在带有标记的映像 - Azure Devops Docker Push: An image does not exist locally with the tag
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM