Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40037

Docker builds fail with "Build info capturing failed for docker image..." exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: artifactory-plugin
    • Environment:
      RHEL 7.2, Docker version 1.12.3, Jenkins 2.19.1(running in Docker, no agents, only master), Artifactory 4.14.1, Artifactory Plugin 2.8.1
    • Similar Issues:

      Description

      Description: I followed Jenkins Artifactory Plugin - Setting Up Docker Build Info and got

      java.lang.IllegalStateException: Build info capturing failed for docker image: artifactory.mycompany.com/mycompany/myproject/myservice:0.0.1.c62f0c8.72 check build info proxy configuration.
        at org.jfrog.hudson.pipeline.steps.DockerPushStep$Execution.run(DockerPushStep.java:104)
        at org.jfrog.hudson.pipeline.steps.DockerPushStep$Execution.run(DockerPushStep.java:61)
        at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40)
        ...
      

      Docker/Server Setup:

      • Instead of using only HTTP_PROXY in /etc/systemd/system/docker.service.d/http-proxy.conf, I also added NO_PROXY to be able to access to Artifactory artifactory.mycompany.com. Please note that adding or removing HTTPS_PROXY does not change anyting. None of the following configurations worked:
        /etc/systemd/system/docker.service.d/http-proxy.conf
        Environment="HTTP_PROXY=http://localhost:9765" "NO_PROXY=.mycompany.com"
        #Environment="HTTP_PROXY=http://localhost:9765" "HTTPS_PROXY=http://localhost:9765" "NO_PROXY=.mycompany.com"
        #Environment="HTTP_PROXY=http://10.74.200.52:9765" "NO_PROXY=localhost,127.0.0.0/8,.mycompany.com"
        #Environment="HTTP_PROXY=http://10.74.200.52:9765" "HTTPS_PROXY=http://10.74.200.52:9765" "NO_PROXY=localhost,127.0.0.0/8,.mycompany.com"
        
      • Although Jenkins Artifactory Plugin - Setting Up Docker Build Info does not mention, I needed to execute sudo chmod 777 /var/run/docker.sock command to prevent following error:
        javax.ws.rs.ProcessingException: org.newsclub.net.unix.AFUNIXSocketException: Permission denied (socket: /run/docker.sock)
          at com.github.dockerjava.jaxrs.connector.ApacheConnector.apply(ApacheConnector.java:484)
          at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246)
          at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:683)
          ...
          at com.github.dockerjava.core.command.InspectImageCmdImpl.exec(InspectImageCmdImpl.java:40)
          at org.jfrog.hudson.pipeline.docker.utils.DockerUtils.getImageIdFromTag(DockerUtils.java:33)
          at org.jfrog.hudson.pipeline.docker.utils.DockerAgentUtils$2.call(DockerAgentUtils.java:67)
          at org.jfrog.hudson.pipeline.docker.utils.DockerAgentUtils$2.call(DockerAgentUtils.java:65)
          at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
          at org.jfrog.hudson.pipeline.docker.utils.DockerAgentUtils.registerImage(DockerAgentUtils.java:65)
        

      Jenkins Setup:

      • There is no Jenkins agent and Jenkins master runs in Docker container.
      • To be able to run docker command in the container, I prefered Docker outside of Docker(dood) solution
      • exposed port 9765 for Artifactory Plugin's internal proxy
      • used volume for Jenkins's data
      • ran Jenkins container as swarm service
      • Followed Jenkins Artifactory Plugin - Setting Up Docker Build Info by choosing port 9765
      Dockerfile.myjenkins
      FROM artifactory.mycompany.com/jenkins
      
      USER root
      
      # To be able to build Docker images within the container, we have chosen 
      # Docker outside of Docker(dood) solution in preference to Docker in 
      # Docker(dind). By using dood we are able to execute "docker" commands
      # without installing Docker into the container. See following
      # pages to get better understanding of all the benefits of dood:
      # - Jenkins with DooD (Docker outside of Docker): https://github.com/axltxl/docker-jenkins-dood
      # - Running Docker in Jenkins (in Docker): http://container-solutions.com/running-docker-in-jenkins-in-docker/
      RUN apt-get update \
       && apt-get install -y sudo \
       && rm -rf /var/lib/apt/lists/* \
       && echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers \
       && printf '#!/bin/bash\nsudo docker.bin "$@"\n' > /usr/local/bin/docker \
       && chmod +x /usr/local/bin/docker
      
      USER jenkins
      
      # Artifactory Plug-in's build-in proxy for Docker images: 
      # https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Artifactory+Plugin+-+Setting+Up+Docker+Build+Info#JenkinsArtifactoryPlugin-SettingUpDockerBuildInfo-EnabletheJenkinsBuildInfoProxy
      EXPOSE 9765
      
      Build & Push myjenkins Image
      docker build -f Dockerfile.myjenkins -t artifactory.mycompany.com/myjenkins .
      ...
      docker push artifactory.mycompany.com/myjenkins
      
      Create myjenkins Swarm Service
      docker service create --name myjenkins -p 8080:8080 -p 50000:50000 -p 9765:9765 --replicas 1 \
        --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock,readonly \
        --mount type=bind,src=$(which docker),dst=/usr/bin/docker.bin \
        --mount type=volume,src=volume_myjenkins,dst=/var/jenkins_home \
        artifactory.mkk.com.tr/myjenkins
      

      Setup Test:

      • On host machine;
        • Connected to port 9765 successfully: telnet localhost 9765
        • Executed following docker command successfully:
          docker pull artifactory.mycompany.com/hello-world
          
      • On Jenkins;
        • Created a dummy job and executed the same docker command successfully.

        Attachments

          Issue Links

            Activity

            Hide
            romang Roman Gurevitch added a comment -

            sébastien glon,
            We are trying to find the root cause for your issues, specifically the following message:
            Connection to server became saturated, stopping reading
            Could you share more details about your Pipeline script and the Docker image that you are pushing?

            Show
            romang Roman Gurevitch added a comment - sébastien glon , We are trying to find the root cause for your issues, specifically the following message: Connection to server became saturated, stopping reading Could you share more details about your Pipeline script and the Docker image that you are pushing?
            Hide
            sebglon sébastien glon added a comment -

            This error is related to FS full

            Show
            sebglon sébastien glon added a comment - This error is related to FS full
            Hide
            sunckell Chad Kellerman added a comment -

            I have been following this thread for a while as I have a similar issue.

            I receive the "Connection to server became saturated, stopping reading" as well, but do not have any full FS.. I can provide more information if needed.

            Show
            sunckell Chad Kellerman added a comment - I have been following this thread for a while as I have a similar issue. I receive the "Connection to server became saturated, stopping reading" as well, but do not have any full FS.. I can provide more information if needed.
            Hide
            romang Roman Gurevitch added a comment -

            For further investigation please contact our support team at support@jfrog.com
            Please attach this Jira issue reference in the mail.

            Show
            romang Roman Gurevitch added a comment - For further investigation please contact our support team at support@jfrog.com Please attach this Jira issue reference in the mail.
            Hide
            sebglon sébastien glon added a comment -

            My jenkins master is on swarm cluster A

            and my slave is spawn on a second swarm cluster B.

            When i build image from my pipeline, i build on docker-in-Docker whit proxy configurer to point on my jenkins Master.

            If i check on debug, i can see buidinfo on my master but have not acces to my Docker-in-Docker and not register ImageId and Image Tag on DockerAgentUtil.registerImage method.

            Why this method check access on Docker Host?

             

            Is it possible add nodo info on BuildInfo for using them on  method updateImageParentOnAgents?

            Because my Jenkins master have buildInfo but no acces to Docker-inDocker and jenkins slave have'n buidInfo and not updateImageParent.

             

             

            Show
            sebglon sébastien glon added a comment - My jenkins master is on swarm cluster A and my slave is spawn on a second swarm cluster B. When i build image from my pipeline, i build on docker-in-Docker whit proxy configurer to point on my jenkins Master. If i check on debug, i can see buidinfo on my master but have not acces to my Docker-in-Docker and not register ImageId and Image Tag on DockerAgentUtil.registerImage method. Why this method check access on Docker Host?   Is it possible add nodo info on BuildInfo for using them on  method updateImageParentOnAgents? Because my Jenkins master have buildInfo but no acces to Docker-inDocker and jenkins slave have'n buidInfo and not updateImageParent.    

              People

              Assignee:
              eyalbe Eyal Ben Moshe
              Reporter:
              as_kumlali Ali Sadik Kumlali
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated: