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

Sh block unexpectedly exits with failure in docker

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Blocker Blocker
    • docker-workflow-plugin
    • None
    • Debian 9 agent, latest plugin versions (plugin, pipeline build-step, commons etc), Jenkins 2.46.3 running on Ubuntu 12.04.

      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.

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

              Created:
              Updated:
              Resolved: