when mounting a host directory -v option. Are the mounts available by the time the ENTRYPOINT starts?

I have a Dockerfile as follows

FROM rajenata/ovs
MAINTAINER Rajesh Nataraja <...>
COPY initovs /sbin/

ENTRYPOINT ["/sbin/initovs"]
CMD ["--help"

Then I execute

  • Deploying Rails app with docker-compose
  • Docker commit does't save changes
  • Docker Nginx disable default exposed port 80
  • Trying to set up a local DNS using a Docker container - Stuck trying to connect to it
  • How to interact with docker swarm to change the strategy in scheduler
  • Docker : Why the Commands from Dockerfile were not being executed?
  • docker run -d rajenata/ovs:2 --net=host --privileged -v /etc/openvswitch:/etc/openvswitch
    

    But the initovs script

    #!/bin/bash
    
    if [ -d "/etc/openvswitch" ]; then
      if [ -f "/etc/openvswitch/conf.db" ]; then
         echo "DB Exists No Need to Create"
      else
         ovsdb-tool create  /etc/openvswitch/conf.db /usr/local/share/openvswitch/vswitch.ovsschema
      fi
    else
      echo "Open V Switch not mounted from Host"
      exit -1
    fi
    

    Returns an exit -1 indicating the mount is not available.

    Is it possible that the ENTRYPOINT executes even before DOCKER completes the mount?

  • empty PATH returned when entering new Docker image
  • Access to a docker container on Heroku
  • Docker: Best way to handle security updates of packages from apt-get inside docker containers
  • How can I call docker API from container (Docker for Mac)
  • Can't get MLT Framework to process audio in Docker container
  • What is cloudfront link?
  • One Solution collect form web for “when mounting a host directory -v option. Are the mounts available by the time the ENTRYPOINT starts?”

    I am guessing you are running this with a normal user. You might not have access to /etc/openvswitch (even though the user is part of docker group). Ideally, mounts are available before the ENTRYPOINT. Even if you create a script echoing only “hello world” and mount that at some location in container and run it on entrypoint, it does print “hello world”. So, mostly to me it seems to be permission issue. You can login to container and see if that file is there or not.

    $ docker run -it rajenata/ovs:2 --net=host --privileged -v /etc/openvswitch:/etc/openvswitch /bin/bash
    container-name# ls /etc/openvswitch
    

    Try to see what error you are getting if you try to perform the same operation as you were performing in the entrypoint.

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