title: Docker permission denied with volume
body: <p>I'm trying to start a Nginx container that serve static content located on the host, in /opt/content.</p>
  
  <p>The container is started with : </p>
  
  <pre><code>docker run -p 8080:80 -v /opt/content:/usr/share/nginx/html nginx:alpine
  </code></pre>
  
  <p>And Nginx keeps giving me 403 Forbidden. Moreover, when trying to inspect the content of the directory, I got strange results :</p>
  
  <pre><code>$ $ docker exec -i -t inspiring_wing /bin/sh
  / # ls -l /usr/share/nginx/
  total 4
  drwxrwxrwx    3 root     root          4096 Aug 15 08:08 html
  / # ls -l /usr/share/nginx/html/
  ls: can't open '/usr/share/nginx/html/': Permission denied
  total 0
  </code></pre>
  
  <p>I <code>chmod -R 777 /opt/</code> to be sure there are no restriction on the host, but it doesn't change anything. I also try to add <code>:ro</code> flag to the volume option with no luck.</p>
  
  <p>How can I make the mounted volume readable by the container ?</p>
  
  <p>UPDATE : here are the full steps I done to reproduce this problem (as root, and with another directory to start from a clean config) :</p>
  
  <pre><code>mkdir /public
  echo "Hello World" &gt; /public/index.html
  chmod -R 777 /public
  docker run -p 8080:80 -d -v /public:/usr/share/nginx/html nginx:alpine
  docker exec -i -t inspiring_wing /bin/sh
  ls -l /usr/share/nginx/html
  </code></pre>
  
  <p>And this last command inside the container returns me : <code>ls -l /usr/share/nginx/html</code>. Of course, replace <code>inspiring_wing</code>  by the name of the created container.</p>