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.

  • API server failed to start up
  • boot2docker host bind mount volume size limited to 1.8 GB
  • Cassandra container with --net=host exits immediately
  • Running a cronjob or task inside a docker cloud container
  • Custom Docker MySQL build won't run
  • Docker and package managers in production
  • Running Kubernetes Example on CoreOS, Part 1 not work
  • Not able to connect to mysql through java application in docker?
  • Arbitrary Code Execution with Docker
  • Locale.Error with building python based docker
  • Mesos Slave Failed to create a containerizer
  • Can I populate the content of the Volume I created in Bluemix Containers?
  • 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.