title: How do I copy files from from the current docker build stage from one directory to another?
body: <p>How is one meant to copy files that are part of the base image of the current stage in a multistage docker build?</p>
  <p>E.g. if I want to start with a base image of alpine 3.7 how would I copy the file <code>/etc/resolv.conf</code> to somewhere I wanted it?</p>
  <hr />
  <p>First version of my Dockerfile:</p>
  <pre><code># Dockerfile
  FROM alpine:3.7 as dev
  WORKDIR /test
  COPY /etc/resolv.conf /test
  </code></pre>
  <pre><code>$ docker build -t foo:bar .
  Sending build context to Docker daemon  14.85kB
  Step 1/3 : FROM alpine:3.7 as dev
   ---&gt; 6d1ef012b567
  Step 2/3 : WORKDIR /test
   ---&gt; Using cache
   ---&gt; a82a71a856b0
  Step 3/3 : COPY /etc/resolv.conf /test
  COPY failed: stat /var/lib/docker/tmp/docker-builder820934750/etc/resolv.conf: no such file or directory
  </code></pre>
  <hr />
  <p>Second version of my Dockerfile:</p>
  <pre><code># Dockerfile
  FROM alpine:3.7 as dev
  WORKDIR /test
  COPY --from=dev /etc/resolv.conf /test
  </code></pre>
  <pre><code>$ docker build -t foo:bar .
  Sending build context to Docker daemon  14.85kB
  Step 1/3 : FROM alpine:3.7 as dev
   ---&gt; 6d1ef012b567
  Step 2/3 : WORKDIR /test
   ---&gt; Using cache
   ---&gt; a82a71a856b0
  Step 3/3 : COPY --from=dev /etc/resolv.conf /test
  invalid from flag value dev: pull access denied for dev, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
  </code></pre>