This is related to "https://stackoverflow.com/questions/36477636/how-do-i-implement-a-shared-hosting-like-service-with-docker".
I am trying to setup a bunch of apache-php containers that should be able to rw
to the docroot, and one single sftp container that should also be able to rw
to the same directory. So, the plan is to create a shared volume, and mount it inside both containers (obviously in different places when it comes to the sftp container). I modified the official php:7-apache launch script like so:
#!/bin/bash
set -e
### > My stuff
chmod g+s /var/www/html
chown -R :2048 /var/www/html
umask
umask 0002
umask
### < My stuff
# Apache gets grumpy about PID files pre-existing
rm -f /var/run/apache2/apache2.pid
exec apache2 -DFOREGROUND
and in fact the two umask
lines confirm that the sandwiched umask 0002
runs correctly. However, when I bash
into the container and test this myself, umask
returns 022
, and if I create any file, they in fact get permissions 644
. I can then manually umask 0002
and any new file gets created with permissions 664
(and 775
for directories).
For this use case, it is critical that both containers (sftp and apache) can read and write in the shared volume. So, how do I go about this?