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.

  • How to add locale in docker container
  • Vagrant docker provisioner doesn't start containers on boot
  • Azure Docker Container - how to pass startup commands to a docker run?
  • How to put fluentd containers behind a load balancer in ECS?
  • Increasing the AWS ECS Task Definition reserved ports limit
  • Terraform unable to get docker to join swarm
  • Remote Debugging with XDebug from inside a Docker Container does not work
  • Docker - check private registry image version
  • Make pdb work with docker
  • Any API or Web UI project to manage a Docker private registry?
  • Can you use a Neo4j database created on a Windows machine as data volume of Neo4j on Docker?
  • Consul Empty reply from server
  • 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.