michaelmcandrew / civicrm-buildkit-docker

This is a read only copy. Please make PRs here: https://lab.civicrm.org/michaelmcandrew/civicrm-buildkit-docker
https://lab.civicrm.org/michaelmcandrew/civicrm-buildkit-docker
GNU Affero General Public License v3.0
40 stars 31 forks source link

Permission error if UID is not 1000 #17

Closed wmortada closed 6 years ago

wmortada commented 6 years ago

The buildkit user has UID = 1000 and GID = 1000. This is fine if the human user has the same UID and GID (which is often the case). However, if the human user has a different UID and GID then you get a permissions error when trying to run e.g. docker-compose exec -u buildkit civicrm civibuild create dmaster --url http://localhost:8080.

The error is:

Directory /buildkit/build exists, but is not writable.

I'm not sure what the best approach for this is. Change the buildkit UID to match the user? Change the permissions on the build folder to allow buildkit to write?

michaelmcandrew commented 6 years ago

Hey @wmortada, hopefully, we can fix this but UID and GID issues do seem to be a bit painful in Docker land.

So I am imagining that the buildkit directory is not owned by the buildkit user, is that right?

Can you run docker-compose exec -u buildkit civicrm ls -la so we can see what the permissions are on the build directory?

michaelmcandrew commented 6 years ago

ah, just read your mattermost chat and realised that you changed the gid on the folder to 1000.

I thought about this a bit more and made a [new release] that allows you to configure the UID and GID. You can to do a custom build but I think it is a decent solution.

See https://github.com/michaelmcandrew/civicrm-buildkit-docker/releases/tag/0.7.0

wmortada commented 6 years ago

Thanks @michaelmcandrew!

I don't know if this is of any help but here's the directory listing:

drwxr-xr-x  20 buildkit buildkit   4096 Apr 23 14:52 .
drwxr-xr-x   1 root     root       4096 Apr 30 09:08 ..
drwxr-xr-x   6 buildkit buildkit   4096 Apr 23 17:33 .amp
-rw-------   1 buildkit buildkit     82 Apr 23 14:49 .bash_history
-rw-r--r--   1 buildkit buildkit    220 Nov  5  2016 .bash_logout
-rw-r--r--   1 buildkit buildkit   3515 Nov  5  2016 .bashrc
drwxr-xr-x   3 buildkit buildkit   4096 Apr 23 14:24 .cache
drwxr-xr-x   3 buildkit buildkit   4096 Apr 23 14:24 .composer
drwx------   3 buildkit buildkit   4096 Apr 23 14:24 .config
drwxr-xr-x   3 buildkit buildkit   4096 Apr 23 14:25 .drush
drwxr-xr-x   8 buildkit buildkit   4096 Apr 23 14:24 .git
-rw-r--r--   1 buildkit buildkit   1001 Apr  2 06:29 .gitignore
drwxr-xr-x   3 buildkit buildkit   4096 Apr 23 14:52 .local
drwxr-xr-x   3 buildkit buildkit   4096 Apr 23 14:24 .node-gyp
drwxr-xr-x   4 buildkit buildkit   4096 Apr 23 14:24 .npm
-rw-r--r--   1 buildkit buildkit    675 Nov  5  2016 .profile
-rw-r--r--   1 buildkit buildkit   1111 Apr  2 06:29 CHANGELOG.md
-rw-r--r--   1 buildkit buildkit   3039 Apr  2 06:29 README.md
drwxr-xr-x  11 buildkit buildkit   4096 Apr 23 14:55 app
drwxr-xr-x   2 buildkit buildkit   4096 Apr 23 14:24 bin
drwxr-xr-x   2 root     root       4096 Apr 30 14:53 build
-rw-r--r--   1 buildkit buildkit   1178 Apr  2 06:29 composer.json
-rw-r--r--   1 buildkit buildkit  60768 Apr  2 06:29 composer.lock
drwxr-xr-x   3 buildkit buildkit   4096 Apr 23 14:24 extern
drwxr-xr-x 302 buildkit buildkit  12288 Apr 23 14:24 node_modules
-rw-r--r--   1 buildkit buildkit 124617 Apr  2 06:31 package-lock.json
-rw-r--r--   1 buildkit buildkit    660 Apr  2 06:29 package.json
-rw-r--r--   1 buildkit buildkit    622 Apr  2 06:29 phpunit.xml.dist
drwxr-xr-x   7 buildkit buildkit   4096 Apr 23 14:24 src
drwxr-xr-x   3 buildkit buildkit   4096 Apr 23 14:24 tests
drwxr-xr-x   6 buildkit buildkit   4096 Apr 23 14:24 vagrant
drwxr-xr-x  19 buildkit buildkit   4096 Apr 23 14:24 vendor
michaelmcandrew commented 6 years ago

thanks @wmortada - yeah - that is what I would expect given what you said in mattermost :)

michaelmcandrew commented 6 years ago

hopefully the new release fixes it for you now anyway