Reputation: 1277
Inside my container I have set umask value to 027 so when ever I create new files it takes u=rwx g=rx- o=---
but when I create a file inside host it takes the umask value from host. How can I prevent this. I mean how can I force the new files to take the umask value that has been set inside container not from host.
version: "3.5"
services:
php:
container_name: ${PROJECT_NAME}
build: ./docker/drupal-tools
image: dbjpanda/drupal-tools
restart: always
working_dir: /var/www/${PROJECT_NAME}
volumes:
- drupal:/var/www/example.com
volumes:
drupal:
driver: local
driver_opts:
type: none
device: $PWD/code/drupal
o: bind
Upvotes: 2
Views: 4521
Reputation: 158758
This isn't possible. Not only do the container and host have different umasks, but each process has its own umask. For that matter, nothing in umask(1) or umask(2) suggests that a process can't subsequently change its own umask to something more permissive: it simply isn't a good security or policy-enforcement control.
Upvotes: 1