title: Why does docker container prompt "Permission denied"?
body: <p>I use following command to run a docker container, and map a directory from host(<code>/root/database</code>) to container(<code>/tmp/install/database</code>):  </p>
  
  <pre><code># docker run -it --name oracle_install -v /root/database:/tmp/install/database bofm/oracle12c:preinstall bash
  </code></pre>
  
  <p>But in container, I find I can't use <code>ls</code> to list contents in <code>/tmp/install/database/</code> though I am <code>root</code> and have all privileges:  </p>
  
  <pre><code>[root@77eb235aceac /]# cd /tmp/install/database/
  [root@77eb235aceac database]# ls
  ls: cannot open directory .: Permission denied
  [root@77eb235aceac database]# id
  uid=0(root) gid=0(root) groups=0(root)
  [root@77eb235aceac database]# cd ..
  [root@77eb235aceac install]# ls -alt
  ......
  drwxr-xr-x. 7 root root  4096 Jul  7  2014 database
  </code></pre>
  
  <p>I check <code>/root/database</code> in host, and all things seem OK:  </p>
  
  <pre><code>[root@localhost ~]# ls -lt
  ......
  drwxr-xr-x.  7 root root       4096 Jul  7  2014 database
  </code></pre>
  
  <p>Why does docker container prompt "Permission denied"?  </p>
  
  <p><strong>Update</strong>:<br>
  The root cause is related to <code>SELinux</code>. Actually, I met similar <a href="https://stackoverflow.com/questions/30091681/why-does-docker-prompt-permission-denied-when-backing-up-the-data-volume">issue</a> last year.</p>