nginx icon indicating copy to clipboard operation
nginx copied to clipboard

Fails when the volume is mounted readonly

Open nedix opened this issue 2 years ago • 2 comments

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

nedix avatar Mar 29 '22 15:03 nedix

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.

nedix avatar Mar 29 '22 15:03 nedix

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.

AaronMcHale avatar Jun 09 '24 17:06 AaronMcHale