Docker container not showing volume mounted – Access issue

root@centdev01$ grep -e CMD -e RUN Dockerfile
RUN apt-get update 
RUN apt-get -y install ruby ruby-dev build-essential redis-tools
RUN gem install --no-rdoc --no-ri sinatra json redis
RUN mkdir -p /opt/webapp
RUN chmod 777 /opt/webapp
CMD ["/opt/webapp/bin/webapp"]

root@centdev01$ docker build -t "alok87/sinatra" .

root@centdev01$ docker run -d -p 80 --name ubunsin10 -v $PWD/webapp:/opt/webapp alok87/sinatra
root@centdev01$ docker logs ubunsin10
/opt/webapp/bin/webapp: Permission Denied - /opt/webapp/bin/webapp ( Errno:EACCESS)

The issue is the volume is being mounted to the container but from the container it is not having any acces to the mounted volume. I can cd to /opt/webapp/bin but i can not ls /opt/webapp/bin.

Please suggest how it can be fixed. The host mount has all files having 777 permission.

  • What permissions do I need to enable for Docker volumes to work?
  • Cannot access docker nginx image on localhost - OSX
  • How does Docker share resources
  • JDBC process seems stopped when running in docker container
  • Docker build leads to “no space left on device” on Windows 10
  • Dockerize Logstash, Redis setup
  • Reuse inherited image's CMD or ENTRYPOINT
  • Docker Centos 7 easy_install supervisor ssl issue behind proxy
  • Accessing a MySql database from external IP (Docker containers)
  • Kubernetes Redis HA and exposing redis to things outside of the container
  • Is Docker Compose suitable for production?
  • Laradock: how to enable/install php7 ldap support extension?
  • One Solution collect form web for “Docker container not showing volume mounted – Access issue”

    Docker processes have the svirt_lxc_net_t default type. By default these processes are not allowed to access your content in /var, /root and /home.

    You have specify a suitable type label for your host folder, to allow the container processes to access the content. You can do this by giving the $PWD/webapp folder the type label svirt_sandbox_file_t.

    chcon -Rt svirt_sandbox_file_t $PWD/webapp

    After this, you can access the folder from within the container. Read more about it in Dan Walsh’s article – Bringing new security features to Docker

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.