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.

  • Creating a cassandra docker image with initialized KEYSPACE and schema
  • Kubernetes locally via docker persistence
  • Invalid parameter value for redirect_uri: Non-public domains not allowed - Spring social login
  • Go cannot create RabbitMQ channel. RabbitMQ server on docker container, Go script on host
  • What is the need for Docker Daemon?
  • Cannot install Django on docker
  • How to run my Go webapp in docker based on scratch as the user nobody?
  • Docker Tomcat exited 0 after run
  • Is it possible to use Kubernetes for Gitlab build runners and how?
  • Docker MongoDB : UserNotFound
  • Docker run start services
  • Running script outside of docker container
  • 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.