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
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
exit -1 indicating the mount is not available.
Is it possible that the
ENTRYPOINT executes even before
DOCKER completes the mount?
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.