Yann PRONO
Yann PRONO

Reputation: 203

Permissions denied with the docker volumes folder when using rails CLI

I started a RoR project. I use docker to easily install what I need (database, external tools...). In the root of my project, I've got a data folder containing all the docker volumes. The issue is when I run rails generate controller X, I don't know why but rails wants to access to the data folder (which is completely useless) and so, I have a permission denied for the data folder;

ruby-2.5.1/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb:192:in `initialize': Permission denied @ dir_initialize - /home/mcdostone/X/Y/data/pgadmin/storage/root (Errno::EACCES)
from ruby-2.5.1/gems/rb-inotify-0.9.10/lib/rb-inotify/notifier.rb:192:in `new'


ll -ah  /home/mcdostone/X/Y/data/
total 16K

drwxr-xr-x     4   root              root    4.0K Aug 21 10:52   ./
drwxr-xr-x    17   mcdostone   mcdostone     4.0K Aug 21 12:59   ../
drwxr-xr-x     4   root              root    4.0K Aug 21 10:54   pgadmin/
drwx------    19   999               root    4.0K Aug 21 10:52   postgres/

Any idea to avoid that unless changing the folder's permissions ? I don't want to break my containers.

Upvotes: 2

Views: 725

Answers (1)

alexanderadam
alexanderadam

Reputation: 445

There are three possible solutions for this problem:

  1. Simply move the directory into the parent directory.
  2. Change your Docker setup so that it uses the same user id that your host system uses (you can control this on some images via environment variables)
  3. The gem rb-inotify cannot exclude properly. It is a known (but closed) issue (48). So you could fix / add the behaviour so that folders with permission errors will be simply ignored or that you can control ignored folders. I'm sure they will happily accept a PR.

Upvotes: 1

Related Questions