title: Unable to access WORKSPACE inside Jenkinsfile pipelines.agent.dockerfile
body: <p>I'm trying to mount the workspace as a volume when using Jenkinsfile, but am getting an error that WORKSPACE does not exist as a binding.</p>
  
  <pre><code>pipeline {
    agent {
      dockerfile {
        filename 'Dockerfile'
        dir 'docker/build_env'
        args "-v ${WORKSPACE}/source:/slate/source -v ${WORKSPACE}/build:/slate/build"
      }
    }
  }
  </code></pre>
  
  <p>And the error is:</p>
  
  <p>groovy.lang.MissingPropertyException: No such property: WORKSPACE for class: groovy.lang.Binding</p>
  
  <p>I've also tried ${env.WORKSPACE} but this resolves as null and pwd() which resolved to a class name. I've previously used ${WORKSPACE} successfully before so I'm at a loss.</p>
  
  <p>Please can someone help with what I'm doing wrong?</p>
  
  <p>Thanks.</p>