title: Copy file from docker image to jenkins workspace
body: <p>I have a jenkinsfile that uses a dockerfile - and am interested in how I can copy a file from the docker image to the jenkins workspace. Specifically - I am generating an HTML report on the docker image that I'd like to have published by the jenkins job.</p>
  
  <p>For example, if I generate a file called <code>test.html</code> in the <code>/app/</code> directory of the docker image - how do I copy it to the jenkins workspace so I can publish it. </p>
  
  <p>Sample <code>Jenkinsfile</code> below:</p>
  
  <pre><code>node ('ondemand') {
      try {
          stage "build"
          checkout scm
          def customImage = docker.build("docker-image:${env.BUILD_ID}", "-f ./docker-image/Dockerfile .")
  
          stage "test copying files"
          customImage.inside('-u root') {
              sh 'touch /app/test.html &amp;&amp; ls' // can see that test.html is generated
  
          }
      }
  </code></pre>