title: How to solve permission denied when mounting volume during docker run command?
body: <p>I'm trying to run a container binding a directory and I get an error about permission being denied, so the container doesn't start at all.</p>
  
  <p>In the current directory there is a directory called <code>main</code> and in the container there is a directory <code>/builder/project</code></p>
  
  <pre><code>david@localhost ~/contrib_archives $ docker run -v `realpath main`:/build/project builder
  docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/home/david/contrib_archives/main\\\" to rootfs \\\"/var/lib/docker/100000.100000/overlay2/2d14c3752819ff12891bace539ae4ef0039c42e6deb00170432c934d681b842e/merged\\\" at \\\"/build/project\\\" caused \\\"stat /home/david/contrib_archives/main: permission denied\\\"\"": unknown.
  ERRO[0000] error waiting for container: context canceled 
  </code></pre>
  
  <p>If I run the container without the <code>-v</code> parameter it runs fine (But it's useless since I can't get the data in).</p>
  
  <p>Anyone has any idea of what the problem could be?</p>
  
  <p>I'm running with user namespaces.</p>