title: jenkins 2.7 pipeline build in docker container
body: <p>I am trying to build my project with Jenkins and pipeline plugin in docker container. My <code>Jenkinsfile</code> looks like this:</p>
  
  <pre><code>node('docker') {
      docker.image('build-node:1').inside {
          stage 'scm checkout'
          checkout scm
  
          stage 'maven build'
          sh "mvn -B clean &gt; mvn.log"
      }
  }
  </code></pre>
  
  <p>In Jenkins log:</p>
  
  <pre><code>...
  Entering stage maven build
  Proceeding
  [Pipeline] sh
  [versioning] Running shell script
  + mvn -B clean
  [Pipeline] }
  $ docker stop ***
  $ docker rm -f ***
  [Pipeline] // withDockerContainer
  [Pipeline] }
  [Pipeline] // node
  [Pipeline] End of Pipeline
  ERROR: script returned exit code -1
  Finished: FAILURE
  </code></pre>
  
  <p>In mvn.log I see all is ok:</p>
  
  <pre><code>...
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: X.XXX s
  [INFO] Finished at: 2016-XX-XXTXX:XX:XX+XX:XX
  [INFO] Final Memory: XXM/XXXM
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p>Where is an error or how determine it?</p>
  
  <p>My Jenkins server is docker container form docker hub, which using docker server as a node.</p>
  
  <p>New check:</p>
  
  <pre><code>try {
      sh 'mvn clean | tee mvn.log'
  } catch (e) {
      println "Maven failed : ${e}"
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>[versioning] Running shell script
  + mvn clean
  + tee mvn.log
  [Pipeline] echo
  Maven failed : hudson.AbortException: script returned exit code -1
  </code></pre>
  
  <p>mvn.log:</p>
  
  <pre><code>[INFO] BUILD SUCCESS
  </code></pre>