I have been working a lot with elasticsearch. I have a huge issue with trying to expand my container HDD space. I want to shift my volumes to an External HDD (NTFS or otherwise), but it seems that when I use docker-compose for something like:
volumes:
- /Volumes/Elements/volume_folder/data03:/usr/share/elasticsearch/data
It seems that it doesn't have write permissions. I confirmed it on Windows and Mac that this is the case, but I figured this is actually a common issue massively overcome with docker already. I have been looking but unable to do this.
How is this done? I have Mounted (internal) Drives on my Windows 10 Machine I wanted to set up to store this data, as well as multiple External HDD I wanted to do the same.
I notice that I as the current user always have the r/w/e privileges to the Devices, so I was thinking that there was a way to have docker run as the current user for the purposes of determining Drive privileges?
The current issue is that a container falls outside the scope of the current user, and it seems that the external is something akin to 775.
Can someone assist with this? I was looking on stackoverflow and all the mounts were based on the host machine, but NOT a different drive like this. I can easily set a volume anywhere on the machine but when it comes to External HDD or H:/ or I:/, it seems to be a different story.
I was looking at this Stackoverflow question: Docker volume on external hard drive and I was looking into seeing what I can do. When I looked at preferences, I saw that /Volumes was shared. When I did docker-compose up
it says that the system is readonly. (Like previously stated). It is 755. Is there a way to run docker compose as a particular user?
Edit: I was noticing that docker-compose allows a user option, and since I saw that the mounted HDD is owned by me. I said create, maybe i can pass my user into each container and it will access it correctly. I saw this article stating i could do this: https://medium.com/redbubble/running-a-docker-container-as-a-non-root-user-7d2e00f8ee15
I added user to each service, like this: user: ${CURRENT_UID}
and then in the CLI, i put a couple different options:
CURRENT_UID="$(whoami)" docker-compose up
CURRENT_UID="$(id -u):$(id -g)" docker-compose up
The top one failed because the user was not in passwd, but the bottom one gave me a "permissions denied" error. I was thinking it might have worked, but didnt.