title: docker ADD --chown bug or feature?
body: <p>I am having a problem adding a file to an image and setting ownership via <code>--chown</code> flag. Specifically, here is a dockerfile adding a simple text file:</p>
  
  <pre><code>FROM fedora:24
  
  ARG user_name=slave
  ARG user_uid=1000
  ARG user_home=/home/$user_name/
  
  RUN useradd -l -u ${user_uid} -ms /bin/bash $user_name
  
  WORKDIR ${user_home}
  USER ${user_name}
  ADD --chown=1397765041:1397765041 test.txt ./
  CMD ls -l
  </code></pre>
  
  <p>This results in expected ownership of <code>text.txt</code> as can be seen:</p>
  
  <pre><code>$ docker run --rm -it bm/tmp:latest
  total 4
  -rw-r--r-- 1 some_user 1397765041 6 Oct 21 20:00 test.txt
  </code></pre>
  
  <p>Cool. Now if I change <code>test.txt</code> to a tar file (for example boost_1_57_0.tar.bz2), and rebuild, this is what I get: </p>
  
  <pre><code>$ docker run --rm -it bm/tmp:latest
  total 4
  drwx------ 8 501 root 4096 Oct 31  2014 boost_1_57_0
  </code></pre>
  
  <p>Here is how I am building (probably doesn't matter tho): </p>
  
  <pre><code>docker build -t bm/tmp --build-arg user_name=some_user --build-arg user_uid=1397765041 .
  </code></pre>
  
  <p>As we can see, ownership is NOT as expected in this case. It seems the behavior of <code>--chown</code> differs from the two cases shown above. I know that <code>ADD</code> automatically extracts tars. I don't know how the ownership is being set in the case where the file is a tar file. Anyone?</p>