title: what is the difference between "withRun" and "inside" in Jenkinsfile?
body: <p>I have a Jenkinsfile in which I am trying to execute <code>npm run test</code> inside a container. 
  When I run with <code>inside</code> it fails but when I run with <code>withRun</code> it runs as I want to.</p>
  
  <p>Code for reference
  with <code>inside</code></p>
  
  <pre><code>stage('Test') {
      docker.image('justinribeiro/chrome-headless').inside ("-p 9222:9222 --security-opt seccomp=$WORKSPACE/chrome.json") { 
          sh label: 
          'Running npm test', 
          script: '''
          npm run test
          '''
        }
      }
  </code></pre>
  
  <p>With <code>withRun</code></p>
  
  <pre><code>stage('Test') {
      docker.image('justinribeiro/chrome-headless').withRun ("-p 9222:9222 --security-opt seccomp=$WORKSPACE/chrome.json") { 
          sh label: 
          'Running npm test', 
          script: '''
          npm run test
          '''
  
      }
    }
  </code></pre>
  
  <p>Now I want to understand what is the difference between them.</p>
  
  <p>I have observed that <code>inside</code> adds volumes and runs <code>cat</code> on container whereas <code>withRun</code> does not.</p>
  
  <p>I also read the documentation <a href="https://jenkins.io/doc/book/pipeline/docker/" rel="noreferrer">https://jenkins.io/doc/book/pipeline/docker/</a> but did not understand well enough.</p>
  
  <p>A much more detailed explanation will be much appreciated.</p>
  
  <p>Thanks.</p>