Permission denied: '/app/database.yml'
Closed this issue · 3 comments
Just confirmed that this problem persisted if I try to run the docker image in non-root user. I have limited experience with docker and I am really confused. It shouldn't be a problem of the ownership of the image, right? Or is it a problem with the drivers?
When your host is Linux, mounted folder permissions WILL affect to the permissions in the container. I use 1001:1001
in these containers.
You can find more information in these blogs, they mention the situation you encountered and how to handle this problem.
- https://mydeveloperplanet.com/2022/10/19/docker-files-and-volumes-permission-denied/
- https://medium.com/@nielssj/docker-volumes-and-file-system-permissions-772c1aee23ca
And, why I write the images with non-root users:
I personally use Windows as the host and am not familiar with actual processing on Linux host. Please let me know if these can solve your problem.
Thanks for your help! I have corrected the permission setting and it runs smoothly. I originally thought it a problem with dockerd instead one with the mounted folder. I guess it's more of a beginner's mistake.
Thank you so much for providing detailed explanation on this topic. I have really learned a lot.