title: nginx alpine docker fails without previous ls?
body: <p>I want to use radicale with nginx inside a alpine based docker file.
  I am currently develop the Dockerfile and noticed a really strange behaivor, maybe somebody can explain this to me.</p>
  
  <ol>
  <li>build image</li>
  </ol>
  
  <p><a href="https://gist.github.com/cdpb/7ab1690f30fe6a911dac" rel="nofollow">https://gist.github.com/cdpb/7ab1690f30fe6a911dac</a></p>
  
  <ol start="2">
  <li><code>docker run -it &lt;id&gt; sh</code></li>
  <li><code>su radicale -c 'nginx -t'</code></li>
  </ol>
  
  <p>:</p>
  
  <pre><code>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  nginx: [emerg] mkdir() "/var/lib/nginx/tmp/client_body" failed (13: Permission denied)
  nginx: configuration file /etc/nginx/nginx.conf test failed
  </code></pre>
  
  <ol start="4">
  <li><code>ls -l /var/lib/nginx/tmp</code></li>
  </ol>
  
  <p>:</p>
  
  <pre><code>total 20
  drwxr-xr-x    2 radicale radicale      4096 Feb 17 11:39 client_body
  drwxr-xr-x    2 radicale radicale      4096 Feb 17 11:39 fastcgi
  drwxr-xr-x    2 radicale radicale      4096 Feb 17 11:39 proxy
  drwxr-xr-x    2 radicale radicale      4096 Feb 17 11:39 scgi
  drwxr-xr-x    2 radicale radicale      4096 Feb 17 11:39 uwsgi
  </code></pre>
  
  <ol start="5">
  <li><code>su radicale -c 'nginx -t'</code></li>
  </ol>
  
  <p>:</p>
  
  <pre><code>nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  nginx: configuration file /etc/nginx/nginx.conf test is successful
  </code></pre>
  
  <p>so what happens after the <code>ls</code>? it should not affect any permissions ... !? Can somebody reproduce this?</p>
  
  <p>Regards</p>
  
  <p>cdpb</p>
  
  <p>UPDATE1: works also with <code>stat /var/lib/nginx/tmp/*</code></p>
  
  <p>UPDATE2: because docker creates a new layer for every command in Dockerfile, I thought that nginx has to be started within the same layer as the chmod/chown layer - didn't fix the problem</p>
  
  <p>UPDATE3: I did the same with a disk installed alpine ( virtualbox ) and the problem didn't occur. So it's more a docker related problem or a special alpine docker one</p>