nginx
nginx copied to clipboard
Fails when the volume is mounted readonly
I would like to mount my volume readonly but the container exits because it can't change ownership of the files.
Steps to reproduce:
$ docker run -v /home/user/www/:/var/www/html/:ro -p 8080:80 wodby/nginx:1.20
Result:
chown: /var/www/html: Read-only file system
docker-entrypoint.sh calls init_volumes which is created during build. I think it might not hurt if the error is simply redirected to stdout and execution continues, like so sudo init_volumes 2>&1
. Better yet would be to not chown at all if the filesystem is readonly.
I would like to be able to use read_only: true
in my docker-compose.yml as a security hardening measure, but run into a similar issue where the container refuses to start with the same message.