Docker volume mount issue to a mounted folder
You might want to use to use a Volume Driver instead of bind-mounting a local filesystem.See Share data among machines
Without knowing more about your environment it is impossible to give a more detailed answer. It would be helpful to know if your container runs in a AWS data center or if you use nfsv3, nfsv4 or cifs for mounting.
The following solution helped me to continue.I wrote a script to check whether the folder exists.The script is then called a command in the docker-compose file.
version:"3" services: flowable-task-handler: build: flowable-task-handler ports: - "8085:8085" command: bash -c "/wait_for_file_mount.sh /mnt/share/fileshares/ && java -jar /app.jar"
wait_for_file_mount.sh
#!/bin/sh# Used to check whether the mount folder is ready for flowable to usemountedfolder="$1"until [ -d "$mountedfolder" ]; do sleep 2; echo error "Mounted folder not found : $mountedfolder"; done;
Its a spring boot application. I have removed the entrypoint in the DockerFile and application is started using the command in docker compose(java -jar /app.jar")
defining the mount propagation as ":shared" should fix this:
-v /autofs:/autofs:shared \
not sure about docker-compose - I don't really use that. but you can define a docker volume with mount propagation and put this into your DC file.