Jenkins Docker 推送到 google 云失败,出现异常

Jenkins Docker Push to google cloud fails with an exception

我正在通过 jenkins 构建一个 docker 映像,并希望使用 jenkins 插件将其部署到 google 云注册表(docker-build-step,Google Container Registry Auth 插件,Google OAuth Credentials 插件),使用以下说明:https://wiki.jenkins-ci.org/display/JENKINS/Google+Container+Registry+Auth+Plugin

我在 GCE 上有一个 VM 实例,我在其中安装了 jenkins 和 docker。 构建工作正常,但是当我试图将它推送到注册表时它失败了:

Successfully built c2ddc81c66d1

[Docker] INFO: Sucessfully created image eu.gcr.io/$project-id/base
[Docker] INFO: Pushing image eu.gcr.io/$project-id/base
ERROR: Build step failed with exception
javax.ws.rs.ProcessingException: org.apache.http.NoHttpResponseException: 127.0.0.1:2375 failed to respond
    at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:513)
    at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246)
    at org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:667)
    at org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:664)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)

--

但是当我尝试通过 SSH 推送它时,它起作用了:

bash-4.2$ whoami
jenkins
bash-4.2$ gcloud docker push eu.gcr.io/$project-id/base
The push refers to a repository [eu.gcr.io/$project-id/base]
41772e41ab05: Layer already exists 
a03f60753e4e: Pushing [=========>                                         ] 9.223 MB/47.44 MB

我相信如果它是来自 google 虚拟机的某种范围,我也不应该通过 ssh 来完成它。难道是jenkins用户环境变量?

有人有类似场景的工作配置吗?任何了解 Jenkins 的人都知道什么样的配置会导致这种情况?

此外,在使用 http://127.0.0.1:2375 作为 docker url 之前,我有 unix:///var/run/docker.sock,并且使用该配置,而不是“127.0 .0.1:2375 no HttpResponseExpcetion" 我在日志中有 "localhost:80 no HttpResponseExpcetion",所以使用套接字也不是解决方案。

此致, JS

该错误与 Jenkins 和 Google Registry 之间的连接失败有关。我假设网络连接没有问题,因为它正在调用本地主机。

[Docker] INFO: Sucessfully created image eu.gcr.io/$project-id/base
[Docker] INFO: Pushing image eu.gcr.io/$project-id/base
ERROR: Build step failed with exception
javax.ws.rs.ProcessingException: org.apache.http.NoHttpResponseException: 127.0.0.1:2375 failed to respond

所以,这给我们留下了一个应用问题。检查您的 Google oAuth 凭据,它可能是抛出 未经授权的访问异常 ,您必须在其中创建凭据.

无论如何,请检查您的日志并提升日志级别,看看是否有任何重要信息未被注意到。