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

Process apparently never started when using two Docker agents

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Ubuntu Xenial, Jenkins 2.239 with all plugins up-to-date

      The following Jenkins works fine:

       

      pipeline {
          agent none
          stages {
              stage('Test') {
                  agent {
                      docker {
                          image 'node:14-alpine'
                          alwaysPull true
                      }
                  }
                  steps {
                      sh 'pwd'
                      sh 'node --version'
                  }
              }
          }
      }
      

       

      The following got some issues and it's stuck on "docker pull node:14-alpine" (from Blue Ocean view):

       

       

      pipeline {
          agent {
              dockerfile {
                  filename 'docker/jenkins-agent/Dockerfile'
                  additionalBuildArgs "--build-arg UID=113"
              }
          }
      
      stages {
          stage('Test') {
                agent {
                    docker {
                        image 'node:14-alpine'
                        alwaysPull true
                    }
                }
                steps {
                    sh 'node --version'
                }
            }
          }
      }

       

      When tried without "alwaysPull true", it got stuck on "docker inspect -f . node:14-alpine — Shell Script".

      My Dockerfile:

       

      FROM ubuntu:focal AS ubuntu
      ENV DEBIAN_FRONTEND noninteractive
      # Creates a user.
      ARG UID=1001
      RUN useradd -rm -d /home/jenkins -s /bin/bash -g root -u $UID jenkins
      USER jenkins
      WORKDIR /home/jenkins
      

       

      Jenkins output:

      ...
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] isUnix
      [Pipeline] sh (
      (hang)

      Error after timeout (docker pull node:14-alpine — Shell Script):

      process apparently never started in /var/lib/jenkins/workspace/Deploy@2@tmp/durable-75354819 (running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer) script returned exit code -2
      

      My understanding is when specifying "agent" inside "stage" it should override/replace the outer "agent", but it seems Jenkins got some issues with this configuration.

          [JENKINS-63449] Process apparently never started when using two Docker agents

          kenorb created issue -
          kenorb made changes -
          Description Original: The following Jenkins works fine:

           
          {code:java}
          pipeline {
              agent none
              stages {
                  stage('Test') {
                      agent {
                          docker {
                              image 'node:14-alpine'
                              alwaysPull true
                          }
                      }
                      steps {
                          sh 'pwd'
                          sh 'node --version'
                      }
                  }
              }
          }
          {code}
           

          The following got some issues and it's stuck on "docker pull node:14-alpine" (from Blue Ocean view):

           

           
          {code:java}
          pipeline {
              agent {
                  dockerfile {
                      filename 'docker/jenkins-agent/Dockerfile'
                      additionalBuildArgs "--build-arg UID=113"
                  }
              }

          stages {
              stage('Test') {
                    agent {
                        docker {
                            image 'node:14-alpine'
                            alwaysPull true
                        }
                    }
                    steps {
                        sh 'node --version'
                    }
                }
              }
          }{code}
           

          When tried without "alwaysPull true", it got stuck on "docker inspect -f . node:14-alpine — Shell Script".

          My Dockerfile:

           
          {code:java}
          FROM ubuntu:focal AS ubuntu
          ENV DEBIAN_FRONTEND noninteractive
          # Creates a user.
          ARG UID=1001
          RUN useradd -rm -d /home/jenkins -s /bin/bash -g root -u $UID jenkins
          USER jenkins
          WORKDIR /home/jenkins
          {code}
           

          Jenkins output:
          {code:java}
          ...
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] isUnix
          [Pipeline] sh (
          (hang){code}
          Error after timeout (docker pull node:14-alpine — Shell Script):
          {code:java}
          process apparently never started in /var/lib/jenkins/workspace/Deploy@2@tmp/durable-75354819 (running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer) script returned exit code -2
          {code}
          New: The following Jenkins works fine:

           
          {code:java}
          pipeline {
              agent none
              stages {
                  stage('Test') {
                      agent {
                          docker {
                              image 'node:14-alpine'
                              alwaysPull true
                          }
                      }
                      steps {
                          sh 'pwd'
                          sh 'node --version'
                      }
                  }
              }
          }
          {code}
           

          The following got some issues and it's stuck on "docker pull node:14-alpine" (from Blue Ocean view):

           

           
          {code:java}
          pipeline {
              agent {
                  dockerfile {
                      filename 'docker/jenkins-agent/Dockerfile'
                      additionalBuildArgs "--build-arg UID=113"
                  }
              }

          stages {
              stage('Test') {
                    agent {
                        docker {
                            image 'node:14-alpine'
                            alwaysPull true
                        }
                    }
                    steps {
                        sh 'node --version'
                    }
                }
              }
          }{code}
           

          When tried without "alwaysPull true", it got stuck on "docker inspect -f . node:14-alpine — Shell Script".

          My Dockerfile:

           
          {code:java}
          FROM ubuntu:focal AS ubuntu
          ENV DEBIAN_FRONTEND noninteractive
          # Creates a user.
          ARG UID=1001
          RUN useradd -rm -d /home/jenkins -s /bin/bash -g root -u $UID jenkins
          USER jenkins
          WORKDIR /home/jenkins
          {code}
           

          Jenkins output:
          {code:java}
          ...
          [Pipeline] withEnv
          [Pipeline] {
          [Pipeline] isUnix
          [Pipeline] sh (
          (hang){code}
          Error after timeout (docker pull node:14-alpine — Shell Script):
          {code:java}
          process apparently never started in /var/lib/jenkins/workspace/Deploy@2@tmp/durable-75354819 (running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer) script returned exit code -2
          {code}
          ----
          My understanding is when specifying "agent" inside "stage" it should override/replace the outer "agent", but it seems Jenkins got some issues with this configuration.
          kenorb made changes -
          Component/s New: durable-task-plugin [ 18622 ]

            Unassigned Unassigned
            kenorb kenorb
            Votes:
            9 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated: