title: Is there a way to COPY a file from parent image in docker to child image on build?
body: <p>I'm trying to make base image (parent image) in docker. When I use <code>COPY</code> to copy some files into child docker image it does not copy that file.</p>
  
  <p>Is there a way to copy a file from parent Dockerfile folder to child Dockerfile?</p>
  
  <p><strong>Parent Dockerfile:</strong></p>
  
  <pre><code>FROM debian:jessie-slim
  
  ONBUILD RUN mkdir /app
  ONBUILD WORKDIR /app
  COPY . .
  </code></pre>
  
  <p>I have a file in base image called <code>package.json</code>. First I used <code>ONBUILD COPY . .</code> to copy that file from the base directory to the child image. I didn't <code>COPY</code> anything. So I thought it is related to <code>ONBUILD</code> and does not see those files, so I removed it but that didn't help neither.</p>
  
  <p>My directories:</p>
  
  <pre><code>base_dir
      Dockerfile
      package.json
  
  child_dir
      Dockerfile
      my_app
  </code></pre>
  
  <p>This is the structure of the images folders for building docker files.</p>