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

  • apt-get install -f does not resolve dependencies
  • FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
  • transform command line docker to Dockerfile
  • docker how to add host entry to generic image available in docker repository
  • docker-proxy using port when no containers are running
  • Docker development workflow with node.js
  • 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?

  • Docker client not able to connect to docker host on VM on Windows 7
  • Connect to cassandra inside docker from other server
  • Accessing consul UI running in docker on OSX
  • Is it possible to install only the docker cli and not the daemon
  • Set Docker attach option --sig-proxy=false to default
  • How can I change docker network ip address in Mac
  • 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.