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

Sh block unexpectedly exits with failure in docker

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Blocker
    • Resolution: Duplicate
    • Component/s: docker-workflow-plugin
    • Labels:
      None
    • Environment:
      Debian 9 agent, latest plugin versions (plugin, pipeline build-step, commons etc), Jenkins 2.46.3 running on Ubuntu 12.04.
    • Similar Issues:

      Description

      Here is our simple pipeline script:

      node('Docker') {
       stage('Build') {
       sh 'sleep 20'
       docker.image('server-x64').inside {
       sh 'sleep 20'
       }
       }
      }

      The first sleep 20 is fine.  Works as expected.  We see the second sleep 20 end immediately.  Here is the output:

      Running on Docker in /home/user1/workspace/DockerHW
       [Pipeline] {
       [Pipeline] stage
       [Pipeline] { (Build)
       [Pipeline] sh
       [DockerHW] Running shell script
       + sleep 20
       [Pipeline] sh
       [DockerHW] Running shell script
       + docker inspect -f . server-x64
       .
       [Pipeline] withDockerContainer
       Docker does not seem to be running inside a container
       $ docker run -t -d -u 1000:1000 -w /home/user1/workspace/DockerHW -v /home/user1/workspace/DockerHW:/home/user1/workspace/DockerHW:rw -v /home/user1/workspace/DockerHW@tmp:/home/user1/workspace/DockerHW@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat server-x64
       [Pipeline] {
       [Pipeline] sh
       [DockerHW] Running shell script
       + sleep 20
       [Pipeline] }
       $ docker stop --time=1 e2586b200ba08c5d65683a5f81093d76628c2bb09bac5c7e0534b2b264e54d55
       $ docker rm -f e2586b200ba08c5d65683a5f81093d76628c2bb09bac5c7e0534b2b264e54d55
       [Pipeline] // withDockerContainer
       [Pipeline] }
       [Pipeline] // stage
       [Pipeline] }
       [Pipeline] // node
       [Pipeline] End of Pipeline
       ERROR: script returned exit code -1
       Finished: FAILURE

      We've tried several other commands other than sleep and they all fail pretty much immediately and there is no error output.  No explanation for the build abort.

        Attachments

          Issue Links

            Activity

            Hide
            kerrhome Shannon Kerr added a comment -

            When I "docker run -i -t server-64 /bin/bash" and run commands, there are no issues.

            Show
            kerrhome Shannon Kerr added a comment - When I "docker run -i -t server-64 /bin/bash" and run commands, there are no issues.
            Hide
            kerrhome Shannon Kerr added a comment -

            May be related to this, but according to this ticket, the issue "fixed itself".

            Show
            kerrhome Shannon Kerr added a comment - May be related to this, but according to this ticket, the issue "fixed itself".
            Hide
            kerrhome Shannon Kerr added a comment -

            Debian OS does not include ps, which is needed.  Installing procps by default in our container resolved the issue.

            Show
            kerrhome Shannon Kerr added a comment - Debian OS does not include ps, which is needed.  Installing procps by default in our container resolved the issue.
            Hide
            oleg_nenashev Oleg Nenashev added a comment - - edited

            FYI Jesse Glick Andrew Bayer Sam Van Oort . Maybe this case deserves some diagnostics

            Show
            oleg_nenashev Oleg Nenashev added a comment - - edited FYI Jesse Glick Andrew Bayer Sam Van Oort . Maybe this case deserves some diagnostics
            Hide
            justinharringa Justin Harringa added a comment -

            Oleg Nenashev - we just hit this too. Looks like Jesse Glick has a potential fix in JENKINS-40101.

            Show
            justinharringa Justin Harringa added a comment - Oleg Nenashev - we just hit this too. Looks like Jesse Glick has a potential fix in JENKINS-40101 .

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              kerrhome Shannon Kerr
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: