代码之家  ›  专栏  ›  技术社区  ›  João Santos

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

  •  1
  • João Santos  · 技术社区  · 8 年前

    我正在通过jenkins构建一个docker映像,并希望使用jenkins插件(docker构建步骤、google Container registry Auth plugin、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$1.call(JerseyInvocation.java:667)
        at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:664)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    

    --

    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
    

    我认为,如果它是来自谷歌虚拟机的某种范围,我也不应该通过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 Http Response Expcetion“,因此使用套接字也不是解决方案。

    当做 JS公司

    1 回复  |  直到 8 年前
        1
  •  0
  •   Frederico Martins    8 年前

    该错误与 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凭据 ,它可以是 未授权访问异常 被抛出,您必须在其中创建凭据。

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