title: open() file failed (13: Permission denied) in nginx & docker & minikube
body: <p><strong>This only happens with docker inside minikube</strong>
  operating on host using minikube docker <code>eval (minikube docker-env)</code></p>
  
  <p>Trying to build a basic setup with Nginx serving a single file:</p>
  
  <p>conf.d/example.conf</p>
  
  <pre><code>server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    server_name localhost;
    location /file.json { root /data/; }
  }
  </code></pre>
  
  <p>data/file.json</p>
  
  <pre><code>{"a": 1}
  </code></pre>
  
  <p>Run using docker nginx image:</p>
  
  <pre><code>docker run -it --rm -v "$(PWD)/conf.d:/etc/nginx/conf.d":ro -v "$(PWD)/data:/data":ro -p 8085:80 nginx
  </code></pre>
  
  <p><code>curl http://localhost/file.json</code> gives me <code>2017/02/01 19:07:39 [error] 6#6: *1 open() "/data/file.json" failed (13: Permission denied)...</code></p>
  
  <p>Cannot figure out how to make this right... Help wanted!</p>
  
  <p>What I've tried so far:</p>
  
  <ol>
  <li><p>providing a custom command like <code>chmod -R o+x /data &amp;&amp; ls -la data &amp;&amp; nginx -g "daemon off;"</code>
  <code>
  -rwxrwx--- 1 root 1013 11 Feb  1 13:08 /data/file.json
  </code>
  chmod does not seem to work properly.
  neither chown :(
  <code>
  $ docker run -it --rm -v "$(PWD):/etc/nginx/conf.d":ro -v "$(PWD)/data:/data" -p 8085:80 nginx bash -c 'chown -R nginx:nginx /data/ &amp;&amp; ls -la /data/ &amp;&amp; nginx -g daemon off;"'
  total 8
  drwxrwx--- 1 root 1013  102 Feb  1 13:08 .
  drwxr-xr-x 1 root root 4096 Feb  1 19:50 ..
  -rwxrwx--- 1 root 1013   11 Feb  1 13:08 pub_key.json
  </code></p></li>
  <li><p>setting a docker user to <code>nginx</code></p></li>
  <li><p><code>chmod -R 777 data</code> on host
  <code>
  $ ls -la data
  drwxrwxrwx  3 antonk  staff   102 Feb  1 17:08 data
  $ docker run -it --rm -v "$(PWD):/etc/nginx/conf.d":ro -v "$(PWD)/data:/data" -p 8085:80 nginx bash -c 'ls -la /data/ &amp;&amp; nginx -g "daemon off;"'
  total 8
  drwxrwx--- 1 root 1013  102 Feb  1 13:08 .
  drwxr-xr-x 1 root root 4096 Feb  1 20:20 ..
  -rwxrwx--- 1 root 1013   11 Feb  1 13:08 pub_key.json
  </code></p>
  
  <p>$ docker version
    Client:
    Version:      1.13.1-rc1
    API version:  1.23
    Go version:   go1.7.4
    Git commit:   2527cfc
    Built:        Sat Jan 28 00:43:00 2017
    OS/Arch:      darwin/amd64</p>
  
  <p>Server:
    Version:      1.11.1
    API version:  1.23 (minimum version )
    Go version:   go1.5.4
    Git commit:   5604cbe
    Built:        Wed Apr 27 00:34:20 2016
    OS/Arch:      linux/amd64
    Experimental: false</p>
  
  <p>minikube version: v0.15.0</p></li>
  </ol>
  
  <p><a href="https://github.com/kubernetes/minikube/issues/1067" rel="nofollow noreferrer">https://github.com/kubernetes/minikube/issues/1067</a></p>