I’m trying to run the nginxinc/nginx-unprivileged image but w/ write access to the /usr/share/nginx/html
directory.
I want write access b/c I’m using envsubst to control my Angular app config. Reference: Angular -> Support multiple environments in the same build -> envsubst idea:
CMD envsubst < index.html > index.html && nginx -g "daemon off;"
I’ve tried granting access to that folder in my Dockerfile via:
RUN chown nginx:nginx /usr/share/nginx/html
but I get:
chown: changing ownership of ‘/usr/share/nginx/html’: Operation not permitted
I’ve seen other approaches that roll their own non-root image like this but seems better to take the official image.
How can I grant write access to the nginx
user? Or perhaps there’s a different approach I should be taking?
ls on that dir output
nginx@b055eb2f6a33:/$ ls -l /usr/share/nginx/html
total 8
-rw-r–r– 1 root root 497 Apr 16 14:29 50x.html
-rw-r–r– 1 root root 615 Apr 16 14:29 index.html