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

Maven build job attempts to connect to 'dockerhost' even when not running in a docker container

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins Master: 2.19.4 LTS running on CentOS7
      Jenkins Slave: CentOS6
      docker-custom-build-environment-plugin 1.6.5

      When the docker-custom-build-environment-plugin is installed, and a DNS entry for 'dockerhost' exists, all Maven Build jobs believe they are running in a docker-ized slave node and attempt to run the maven-agent.jar with the argument 'dockerhost:<port>'

       

      This happens even when Jenkins Slaves are not running in containers, and appears to be caused by the logic in the file:

      MavenPluginHelper.java (com.cloudbees.jenkins.plugins.docker_build_env)

       

      I believe this only affects jobs of type 'Maven Build' (not Freestyle job), but I'm not totally sure.

       

      We discovered this because suddenly all of our Maven Build jobs were broken and started invoking maven in the following manner, as soon as a DNS CNAME alias for 'dockerhost' was created in our corporate DNS.  In this particular case, 'dockerhost' was created by a totally separate team of people on our network and not related to our Jenkins infrastructure in any way (and firewalled off from our Jenkins nodes).

       

      When 'dockerhost' is not defined in DNS, maven jobs work correctly:

      Checking out Revision c80a093175952e671c14d26ffaea259bf2772eb6 (refs/remotes/origin/master)
       > git config core.sparsecheckout # timeout=10
       > git checkout -f c80a093175952e671c14d26ffaea259bf2772eb6
       > git rev-list e286a76a8086e96bec65c708f514556be03a882b # timeout=10
      Parsing POMs
      Replacing all maven server entries not found in credentials list is true
      Established TCP socket on 34538
      maven33-agent.jar already up to date
      maven33-interceptor.jar already up to date
      maven3-interceptor-commons.jar already up to date
      [cyberoptic-demo-core-messages] $ /etc/alternatives/java_sdk_1.8.0/bin/java -cp /var/lib/jenkins/slave-node/maven33-agent.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main /opt/apache-maven-3.3.3 /var/lib/jenkins/slave-node/slave.jar /var/lib/jenkins/slave-node/maven33-interceptor.jar /var/lib/jenkins/slave-node/maven3-interceptor-commons.jar 34538
      <===[JENKINS REMOTING CAPACITY]===>channel started
      

      When 'dockerhost' is defined in DNS, maven jobs always seem so think they are running in a docker container, which causes a networking error

      Checking out Revision dec7b232c84c914cf3c4c7f0f18f3c85835b3097 (refs/remotes/origin/master)
       > git config core.sparsecheckout # timeout=10
       > git checkout -f dec7b232c84c914cf3c4c7f0f18f3c85835b3097
       > git rev-list dec7b232c84c914cf3c4c7f0f18f3c85835b3097 # timeout=10
      Parsing POMs
      Replacing all maven server entries not found in credentials list is true
      Established TCP socket on dockerhost:57438
      maven33-agent.jar already up to date
      maven33-interceptor.jar already up to date
      maven3-interceptor-commons.jar already up to date
      [cyberoptic-demo-core-messages] $ /etc/alternatives/java_sdk_1.8.0/bin/java -cp /var/lib/jenkins/slave-node/maven33-agent.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main /opt/apache-maven-3.3.3 /var/lib/jenkins/slave-node/slave.jar /var/lib/jenkins/slave-node/maven33-interceptor.jar /var/lib/jenkins/slave-node/maven3-interceptor-commons.jar dockerhost:57438
      Exception in thread "main" java.net.NoRouteToHostException: No route to host
      	at java.net.PlainSocketImpl.socketConnect(Native Method)
      	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
      

       

          [JENKINS-44782] Maven build job attempts to connect to 'dockerhost' even when not running in a docker container

          Jeff Thornsen created issue -
          Jeff Thornsen made changes -
          Link New: This issue is related to JENKINS-29674 [ JENKINS-29674 ]
          Jeff Thornsen made changes -
          Link New: This issue is related to JENKINS-32542 [ JENKINS-32542 ]
          Jeff Thornsen made changes -
          Description Original: When the docker-custom-build-environment-plugin is installed, *and* a DNS entry for 'dockerhost' exists, all Maven Build jobs believe they are running in a docker-ized slave node and attempt to invoke maven with the argument 'dockerhost:<port>'

           

          This happens even when Jenkins Slaves are not running in containers, and appears to be caused by the logic in the file:

          MavenPluginHelper.java (com.cloudbees.jenkins.plugins.docker_build_env)

           

          I believe this only affects jobs of type 'Maven Build' (not Freestyle job), but I'm not totally sure.

           

          We discovered this because suddenly all of our Maven Build jobs were broken and started invoking maven in the following manner, as soon as a DNS CNAME alias for 'dockerhost' was created in our corporate DNS.

           

          When 'dockerhost' is not defined in DNS, maven jobs work correctly:
          {code:java}
          Checking out Revision c80a093175952e671c14d26ffaea259bf2772eb6 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f c80a093175952e671c14d26ffaea259bf2772eb6
           > git rev-list e286a76a8086e96bec65c708f514556be03a882b # timeout=10
          Parsing POMs
          Replacing all maven server entries not found in credentials list is true
          Established TCP socket on 34538
          maven33-agent.jar already up to date
          maven33-interceptor.jar already up to date
          maven3-interceptor-commons.jar already up to date
          [cyberoptic-demo-core-messages] $ /etc/alternatives/java_sdk_1.8.0/bin/java -cp /var/lib/jenkins/slave-node/maven33-agent.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main /opt/apache-maven-3.3.3 /var/lib/jenkins/slave-node/slave.jar /var/lib/jenkins/slave-node/maven33-interceptor.jar /var/lib/jenkins/slave-node/maven3-interceptor-commons.jar 34538
          <===[JENKINS REMOTING CAPACITY]===>channel started
          {code}
          When 'dockerhost' is defined in DNS, maven jobs *always* seem so think they are running in a docker container, which invokes maven incorrectly.
          {code:java}
          Checking out Revision dec7b232c84c914cf3c4c7f0f18f3c85835b3097 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f dec7b232c84c914cf3c4c7f0f18f3c85835b3097
           > git rev-list dec7b232c84c914cf3c4c7f0f18f3c85835b3097 # timeout=10
          Parsing POMs
          Replacing all maven server entries not found in credentials list is true
          Established TCP socket on dockerhost:57438
          maven33-agent.jar already up to date
          maven33-interceptor.jar already up to date
          maven3-interceptor-commons.jar already up to date
          [cyberoptic-demo-core-messages] $ /etc/alternatives/java_sdk_1.8.0/bin/java -cp /var/lib/jenkins/slave-node/maven33-agent.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main /opt/apache-maven-3.3.3 /var/lib/jenkins/slave-node/slave.jar /var/lib/jenkins/slave-node/maven33-interceptor.jar /var/lib/jenkins/slave-node/maven3-interceptor-commons.jar dockerhost:57438
          Exception in thread "main" java.net.NoRouteToHostException: No route to host
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
          {code}
           
          New: When the docker-custom-build-environment-plugin is installed, *and* a DNS entry for 'dockerhost' exists, all Maven Build jobs believe they are running in a docker-ized slave node and attempt to invoke maven with the argument 'dockerhost:<port>'

           

          This happens even when Jenkins Slaves are not running in containers, and appears to be caused by the logic in the file:

          MavenPluginHelper.java (com.cloudbees.jenkins.plugins.docker_build_env)

           

          I believe this only affects jobs of type 'Maven Build' (not Freestyle job), but I'm not totally sure.

           

          We discovered this because suddenly all of our Maven Build jobs were broken and started invoking maven in the following manner, as soon as a DNS CNAME alias for 'dockerhost' was created in our corporate DNS.

           

          When 'dockerhost' is not defined in DNS, maven jobs work correctly:
          {code:java}
          Checking out Revision c80a093175952e671c14d26ffaea259bf2772eb6 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f c80a093175952e671c14d26ffaea259bf2772eb6
           > git rev-list e286a76a8086e96bec65c708f514556be03a882b # timeout=10
          Parsing POMs
          Replacing all maven server entries not found in credentials list is true
          Established TCP socket on 34538
          maven33-agent.jar already up to date
          maven33-interceptor.jar already up to date
          maven3-interceptor-commons.jar already up to date
          [cyberoptic-demo-core-messages] $ /etc/alternatives/java_sdk_1.8.0/bin/java -cp /var/lib/jenkins/slave-node/maven33-agent.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main /opt/apache-maven-3.3.3 /var/lib/jenkins/slave-node/slave.jar /var/lib/jenkins/slave-node/maven33-interceptor.jar /var/lib/jenkins/slave-node/maven3-interceptor-commons.jar 34538
          <===[JENKINS REMOTING CAPACITY]===>channel started
          {code}
          When 'dockerhost' is defined in DNS, maven jobs *always* seem so think they are running in a docker container, which causes a networking error
          {code:java}
          Checking out Revision dec7b232c84c914cf3c4c7f0f18f3c85835b3097 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f dec7b232c84c914cf3c4c7f0f18f3c85835b3097
           > git rev-list dec7b232c84c914cf3c4c7f0f18f3c85835b3097 # timeout=10
          Parsing POMs
          Replacing all maven server entries not found in credentials list is true
          Established TCP socket on dockerhost:57438
          maven33-agent.jar already up to date
          maven33-interceptor.jar already up to date
          maven3-interceptor-commons.jar already up to date
          [cyberoptic-demo-core-messages] $ /etc/alternatives/java_sdk_1.8.0/bin/java -cp /var/lib/jenkins/slave-node/maven33-agent.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main /opt/apache-maven-3.3.3 /var/lib/jenkins/slave-node/slave.jar /var/lib/jenkins/slave-node/maven33-interceptor.jar /var/lib/jenkins/slave-node/maven3-interceptor-commons.jar dockerhost:57438
          Exception in thread "main" java.net.NoRouteToHostException: No route to host
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
          {code}
           
          Jeff Thornsen made changes -
          Description Original: When the docker-custom-build-environment-plugin is installed, *and* a DNS entry for 'dockerhost' exists, all Maven Build jobs believe they are running in a docker-ized slave node and attempt to invoke maven with the argument 'dockerhost:<port>'

           

          This happens even when Jenkins Slaves are not running in containers, and appears to be caused by the logic in the file:

          MavenPluginHelper.java (com.cloudbees.jenkins.plugins.docker_build_env)

           

          I believe this only affects jobs of type 'Maven Build' (not Freestyle job), but I'm not totally sure.

           

          We discovered this because suddenly all of our Maven Build jobs were broken and started invoking maven in the following manner, as soon as a DNS CNAME alias for 'dockerhost' was created in our corporate DNS.

           

          When 'dockerhost' is not defined in DNS, maven jobs work correctly:
          {code:java}
          Checking out Revision c80a093175952e671c14d26ffaea259bf2772eb6 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f c80a093175952e671c14d26ffaea259bf2772eb6
           > git rev-list e286a76a8086e96bec65c708f514556be03a882b # timeout=10
          Parsing POMs
          Replacing all maven server entries not found in credentials list is true
          Established TCP socket on 34538
          maven33-agent.jar already up to date
          maven33-interceptor.jar already up to date
          maven3-interceptor-commons.jar already up to date
          [cyberoptic-demo-core-messages] $ /etc/alternatives/java_sdk_1.8.0/bin/java -cp /var/lib/jenkins/slave-node/maven33-agent.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main /opt/apache-maven-3.3.3 /var/lib/jenkins/slave-node/slave.jar /var/lib/jenkins/slave-node/maven33-interceptor.jar /var/lib/jenkins/slave-node/maven3-interceptor-commons.jar 34538
          <===[JENKINS REMOTING CAPACITY]===>channel started
          {code}
          When 'dockerhost' is defined in DNS, maven jobs *always* seem so think they are running in a docker container, which causes a networking error
          {code:java}
          Checking out Revision dec7b232c84c914cf3c4c7f0f18f3c85835b3097 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f dec7b232c84c914cf3c4c7f0f18f3c85835b3097
           > git rev-list dec7b232c84c914cf3c4c7f0f18f3c85835b3097 # timeout=10
          Parsing POMs
          Replacing all maven server entries not found in credentials list is true
          Established TCP socket on dockerhost:57438
          maven33-agent.jar already up to date
          maven33-interceptor.jar already up to date
          maven3-interceptor-commons.jar already up to date
          [cyberoptic-demo-core-messages] $ /etc/alternatives/java_sdk_1.8.0/bin/java -cp /var/lib/jenkins/slave-node/maven33-agent.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main /opt/apache-maven-3.3.3 /var/lib/jenkins/slave-node/slave.jar /var/lib/jenkins/slave-node/maven33-interceptor.jar /var/lib/jenkins/slave-node/maven3-interceptor-commons.jar dockerhost:57438
          Exception in thread "main" java.net.NoRouteToHostException: No route to host
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
          {code}
           
          New: When the docker-custom-build-environment-plugin is installed, *and* a DNS entry for 'dockerhost' exists, all Maven Build jobs believe they are running in a docker-ized slave node and attempt to run the maven-agent.jar with the argument 'dockerhost:<port>'

           

          This happens even when Jenkins Slaves are not running in containers, and appears to be caused by the logic in the file:

          MavenPluginHelper.java (com.cloudbees.jenkins.plugins.docker_build_env)

           

          I believe this only affects jobs of type 'Maven Build' (not Freestyle job), but I'm not totally sure.

           

          We discovered this because suddenly all of our Maven Build jobs were broken and started invoking maven in the following manner, as soon as a DNS CNAME alias for 'dockerhost' was created in our corporate DNS.  In this particular case, 'dockerhost' was created by a totally separate team of people on our network and not related to our Jenkins infrastructure in any way (and firewalled off from our Jenkins nodes).

           

          When 'dockerhost' is not defined in DNS, maven jobs work correctly:
          {code:java}
          Checking out Revision c80a093175952e671c14d26ffaea259bf2772eb6 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f c80a093175952e671c14d26ffaea259bf2772eb6
           > git rev-list e286a76a8086e96bec65c708f514556be03a882b # timeout=10
          Parsing POMs
          Replacing all maven server entries not found in credentials list is true
          Established TCP socket on 34538
          maven33-agent.jar already up to date
          maven33-interceptor.jar already up to date
          maven3-interceptor-commons.jar already up to date
          [cyberoptic-demo-core-messages] $ /etc/alternatives/java_sdk_1.8.0/bin/java -cp /var/lib/jenkins/slave-node/maven33-agent.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main /opt/apache-maven-3.3.3 /var/lib/jenkins/slave-node/slave.jar /var/lib/jenkins/slave-node/maven33-interceptor.jar /var/lib/jenkins/slave-node/maven3-interceptor-commons.jar 34538
          <===[JENKINS REMOTING CAPACITY]===>channel started
          {code}
          When 'dockerhost' is defined in DNS, maven jobs *always* seem so think they are running in a docker container, which causes a networking error
          {code:java}
          Checking out Revision dec7b232c84c914cf3c4c7f0f18f3c85835b3097 (refs/remotes/origin/master)
           > git config core.sparsecheckout # timeout=10
           > git checkout -f dec7b232c84c914cf3c4c7f0f18f3c85835b3097
           > git rev-list dec7b232c84c914cf3c4c7f0f18f3c85835b3097 # timeout=10
          Parsing POMs
          Replacing all maven server entries not found in credentials list is true
          Established TCP socket on dockerhost:57438
          maven33-agent.jar already up to date
          maven33-interceptor.jar already up to date
          maven3-interceptor-commons.jar already up to date
          [cyberoptic-demo-core-messages] $ /etc/alternatives/java_sdk_1.8.0/bin/java -cp /var/lib/jenkins/slave-node/maven33-agent.jar:/opt/apache-maven-3.3.3/boot/plexus-classworlds-2.5.2.jar:/opt/apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main /opt/apache-maven-3.3.3 /var/lib/jenkins/slave-node/slave.jar /var/lib/jenkins/slave-node/maven33-interceptor.jar /var/lib/jenkins/slave-node/maven3-interceptor-commons.jar dockerhost:57438
          Exception in thread "main" java.net.NoRouteToHostException: No route to host
          at java.net.PlainSocketImpl.socketConnect(Native Method)
          at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
          {code}
           
          Nicolas De Loof made changes -
          Assignee Original: Nicolas De Loof [ ndeloof ]

            Unassigned Unassigned
            jthornsen Jeff Thornsen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: