Hello,
I am unable to mount file to docker container by no means.
What I have:
- Linux x64 Mint (no SElinux)
- Docker community edition
- directory /elastic/docs and inside is file test.key
files have permissions as follows:
-rw-rw-rw- l user user test.key
docker work directory is: /home/docker/
1st Attempt:
in docker compose I did set it up as follows:
volumes:
- ./elastic/docs/test.key:/usr/share/elastic/docs/test.key:ro
- ./elastic/docs/test.key:/usr/share/elastic/docs/test.key:ro instead of passing the file creates empty folder named test.key
So in the end in host machine in /home/docker/elastic/docs i have:
test.key (this is folder that docker created when running docker compose up)
test.key (this is file)
2nd Attempt:
In docker compose I did try to mount whole directory
volumes:
- ./elastic/docs:/usr/share/elastic/docs:ro
This time I am not able to read the file inside and I get error in container as follows:
Caused by: java.security.AccessControlException: access denied (“java.io.FilePermission” “/usr/share/elastic/docs/test.key” “read”)
I have no idea why I cannot pass this folder or file so that it will be accessible by container. Can someone tell me what i am doing wrong?