title: why doesn't chown work in Dockerfile?
body: <p>My Dockerfile creates a directory, chown's it, and then lists the directory afterwards.  The directory is still owned by root.  Why is that?</p>
  
  <p>Here is the Dockerfile:</p>
  
  <pre><code>FROM ubuntu:precise
  RUN useradd -d /home/testuser -m -s /bin/bash testuser
  RUN mkdir -p /var/local/testrunner/logs
  VOLUME ["/var/local/testrunner/logs"]
  RUN grep testuser /etc/passwd
  RUN grep root /etc/passwd
  RUN chown -R testuser:testuser /var/local/testrunner/logs
  RUN ls -ld /var/local/testrunner/logs 
  </code></pre>
  
  <p>Here is the output from "docker build":</p>
  
  <pre><code>Sending build context to Docker daemon 10.24 kB
  Sending build context to Docker daemon 
  Step 0 : FROM ubuntu:precise
   ---&gt; ab8e2728644c
  Step 1 : RUN useradd -d /home/testuser -m -s /bin/bash testuser
   ---&gt; Using cache
   ---&gt; 640f12671c86
  Step 2 : RUN mkdir -p /var/local/testrunner/logs
   ---&gt; Using cache
   ---&gt; bf7756fd5b1f
  Step 3 : VOLUME ["/var/local/testrunner/logs"]
   ---&gt; Using cache
   ---&gt; 65c73ee76c20
  Step 4 : RUN grep testuser /etc/passwd
   ---&gt; Using cache
   ---&gt; db72fff0b965
  Step 5 : RUN grep root /etc/passwd
   ---&gt; Running in ebff78df7a9a
  root:x:0:0:root:/root:/bin/bash
   ---&gt; ead0ff704a59
  Removing intermediate container ebff78df7a9a
  Step 6 : RUN chown -R testuser:testuser /var/local/testrunner/logs
   ---&gt; Running in c925f67b2ab4
   ---&gt; 253132be935e
  Removing intermediate container c925f67b2ab4
  Step 7 : RUN ls -ld /var/local/testrunner/logs
   ---&gt; Running in 978bc66aa47e
  drwxr-xr-x 2 root staff 4096 Oct  1 15:15 /var/local/testrunner/logs
  </code></pre>
  
  <p>Docker version 1.2.0, build fa7b24f</p>
  
  <p>The host runs Ubuntu 12.04, but with a 3.13.0-36-generic kernel.</p>