Reputation: 650
Using the following dockerfile, I'm trying to create a folder which is writable for PHP.
FROM trafex/alpine-nginx-php7:1.2.0
# Add mysql pdo extensions
USER root
RUN apk add php7-pdo php7-pdo_mysql
COPY --chown=nobody:nobody nginx.conf /etc/nginx/nginx.conf
COPY --chown=nobody:nobody public_html/ /var/www/html
RUN chmod 777 /var/www/html/public/ifpos/hits && ls -l /var/www/html/public/ifpos/
USER nobody
During the build this is what I see
Step 6/7 : RUN chmod 777 /var/www/html/public/ifpos/hits && ls -l /var/www/html/public/ifpos/
---> Running in 027345f34fc9
total 8
drwxrwxrwx 2 nobody nobody 4096 Jan 17 04:21 hits
-rw-r--r-- 1 nobody nobody 817 Jan 17 03:04 listener.php
However when I terminal into the container and list the directory, I can see this hasn't been set correctly.
/var/www/html/public/ifpos $ ls -l
total 8
dr-xr-xr-x 2 nobody nobody 4096 Jan 17 04:21 hits
-rw-r--r-- 1 nobody nobody 817 Jan 17 03:04 listener.php
Please help, this is doing my head in!
Upvotes: 0
Views: 273
Reputation: 11193
This happens because /var/www/html
is marked as VOLUME
in trafex/alpine-nginx-php7:1.2.0
image - https://hub.docker.com/r/trafex/alpine-nginx-php7/dockerfile
You can run the chmod
as part of entrypoint script which does the chmod
first and then calls the actual entrypoing "/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"
Upvotes: 1