-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
The docker host uses a NFS mount with documents and custom stored on it.
I use this directory in the volume for dolibarr
I want to use UID 1001 and GID 100 because I use those IDs in my mount.
In the container, as GID 100 is already used by "users" by default, it cannot be assigned to www-data. In addition, there's a complain in the docker logs when the script has to change ownership.
The mounted volume already has the right user and group, but not for dolibarr.
I don't know if the group is used for anything in dolibarr as I've not used it that much.
services:
dolibarr:
image: dolibarr/dolibarr:20.0.3-php8.2
restart: unless-stopped
container_name: dolibarr
volumes:
- /srv/nfs/config/dolibarr/documents:/var/www/documents
- /srv/nfs/config/dolibarr/custom:/var/www/html/custom
ports:
- 80:80
environment:
WWW_USER_ID: "1001"
WWW_GROUP_ID: "100"dolibarr | As UID / GID have changed from default, update ownership for files in /var/ww ...
dolibarr | chown: changing ownership of '/var/www/html/custom': Operation not permitted
dolibarr | chown: changing ownership of '/var/www/documents/users/temp': Operation not permitted
dolibarr | chown: changing ownership of '/var/www/documents/users': Operation not permitted
dolibarr | chown: changing ownership of '/var/www/documents/stock': Operation not permitted
dolibarr | chown: changing ownership of '/var/www/documents/expedition/sending': Operation not permitted
dolibarr | chown: changing ownership of '/var/www/documents/expedition/receipt': Operation not permitted
dolibarr | chown: changing ownership of '/var/www/documents/expedition': Operation not permitted
...
Is there a chance to have a more flexible approach than this one regarding UID/GID management ?
Lines 423 to 437 in d786523
| # Set permission | |
| local CURRENT_UID=$(id -u www-data) | |
| local CURRENT_GID=$(id -g www-data) | |
| usermod -u ${WWW_USER_ID} www-data | |
| groupmod -g ${WWW_GROUP_ID} www-data | |
| if [[ ${CURRENT_UID} -ne ${WWW_USER_ID} || ${CURRENT_GID} -ne ${WWW_GROUP_ID} ]]; then | |
| # Refresh file ownership cause it has changed | |
| echo "As UID / GID have changed from default, update ownership for files in /var/ww ..." | |
| chown -R www-data:www-data /var/www | |
| else | |
| # Reducing load on init : change ownership only for volumes declared in docker | |
| echo "Update ownership for files in /var/www/documents ..." | |
| chown -R www-data:www-data /var/www/documents | |
| fi |
Metadata
Metadata
Assignees
Labels
No labels