title: PermissionError [Errno 13] Permission Denied Accessing File in Docker Container Built from Network Share
body: <p>I tried to run a docker container that I built on a mounted network volume under Parallels.  I am adding this here to document the issue as it is different from: <a href="https://stackoverflow.com/questions/56784492/permissionerror-errno-13-permission-denied-manage-py">PermissionError: [Errno 13] Permission denied: &#39;/manage.py&#39;</a>, in that this is not an issue with /var/run/docker.sock at all but with a little known issue with the permissions on network shares and how this intersects with your container image after building.</p>
  <p>Steps to reproduce the issue, this is from the Flask demo app which I was modifying to run under Kubernetes.</p>
  <p>Pertinent excerpt from Dockerfile:</p>
  <pre><code>WORKDIR /flaskr
  COPY ./flaskr .
  </code></pre>
  <p>Build the image normally, then run the image with:</p>
  <pre><code>docker run -p 5001:5000 flaskr-k8s:0.1.0
  </code></pre>
  <p>The result:</p>
  <pre><code>  PermissionError
  
    [Errno 13] Permission denied: '/flaskr/app.py'
  
    at /usr/local/lib/python3.9/os.py:597 in _execvpe
         593│         argrest = (args,)
         594│         env = environ
         595│ 
         596│     if path.dirname(file):
      →  597│         exec_func(file, *argrest)
         598│         return
         599│     saved_exc = None
         600│     path_list = get_exec_path(env)
         601│     if name != 'nt':
  </code></pre>