title: COPY failed: Forbidden path outside the build context
body: <p>I have a monorepo that has holds various Go services and libraries. The directory structure is like the following:</p>
  <pre><code>monorepo
   services 
    service-a 
     - Dockerfile
  go.mod
  go.sum
  </code></pre>
  <p>This <code>go.mod</code> file resides in the root of the <code>monorepo</code> directory and the services use the dependencies stated in that file.</p>
  <p>I build the Docker image with this command:</p>
  <pre><code>docker build -t some:tag ./services/service-a/
  </code></pre>
  <p>When I try to build my Docker image from the root of <code>monorepo</code> directory with the above docker command I get the following error:</p>
  <blockquote>
  <p>COPY failed: Forbidden path outside the build context: ../../go.mod ()</p>
  </blockquote>
  <p>Below is my Dockerfile</p>
  <pre><code>FROM golang:1.14.1-alpine3.11
  
  RUN apk add --no-cache ca-certificates git
  
  # Enable Go Modules
  ENV GO111MODULE=on
  
  # Set the Current Working Directory inside the container
  WORKDIR /app
  
  # Copy go mod and sum files
  COPY ../../go.mod go.sum ./
  
  RUN go mod download
  
  COPY . .
  
  RUN CGO_ENABLED=0 go build -o service-a
  
  ENTRYPOINT [&quot;/app/service-a&quot;]
  </code></pre>
  <p>Is there something I have to do to be able to add files into my Docker image that aren't in the current directory without having to have a separate go.mod and go.sum in each service within the monorepo?</p>