title: How to access Docker build context path inside Dockerfile
body: <p>I have Dockerfile defined in a directory  </p>
  
  <pre><code>C:\work\Personal\API\api-service
  </code></pre>
  
  <p>Dockerfile</p>
  
  <pre><code>FROM maven:3.6.1-jdk-8 AS BUILD_IMAGE 
  COPY api-service /usr/src/app/api-service
  COPY pom.xml /usr/src/app  
  RUN mvn -f /usr/src/app/pom.xml clean install
  </code></pre>
  
  <p>I am trying to run <code>docker build C:\work\Personal\API\api-service</code> from <code>C:</code></p>
  
  <p>This results in error saying </p>
  
  <pre><code>COPY failed: stat /var/lib/docker/tmp/docker-builder483308674/api-init-service: no such file or directory
  </code></pre>
  
  <p>In order from me to copy the source code from local machine to docker, i need to know the location of build context folder inside my <code>Dockerfile</code>.</p>
  
  <p>Is there any way to access build context folder passed to <code>docker build</code> command inside a <code>Dockerfile</code>?</p>
  
  <p>In my local machine i can run <code>docker build</code> command from same directory as <code>Dockerfile</code> is located. But from CI tool i will not know where the <code>docker build</code>command will be executed. Hence if i know the <code>docker build</code> context path passed as argument, i can copy the source code into docker image based on the context path. </p>