I have a bind mount configured from a local directory to a directory in a docker container. I am able write to and read back from the mount, but when I try to read a file that already existed in the local directory I get a No such file or directory
error:
root@7206541d128a:/var/lib/myapp/testdata# ls
file_a.txt
root@7206541d128a:/var/lib/myapp/testdata# cat file_a.txt
cat: file_a.txt: No such file or directory
root@7206541d128a:/var/lib/myapp/testdata# echo hi > file_b.txt
root@7206541d128a:/var/lib/myapp/testdata# cat file_b.txt
hi
This is the mounts information from docker inspect
:
"Mounts": [
{
"Type": "bind",
"Source": "/path/to/local/dir",
"Destination": "/var/lib/myapp/testdata",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
},
How can I read existing files from this mount within the container?