docker-nginx icon indicating copy to clipboard operation
docker-nginx copied to clipboard

Skip configuring image in read-only systems

Open alessfg opened this issue 2 years ago • 3 comments

The image in its current state fails when being run in read-only systems (https://github.com/nginxinc/docker-nginx-unprivileged/issues/43). This PR aims to fix that.

alessfg avatar Jul 20 '23 19:07 alessfg

If the user is providing or relying on the scripts in /docker-entrypoint.d/ but not also providing the place they are expected to write as writeable, then the image shouldn't just ignore the scripts. Failure is the expected result so that they can fix their setup instead of getting a misconfigured service.

yosifkit avatar Jul 20 '23 21:07 yosifkit

The intent (and the overall intent of the thread in the linked issue) of this PR is for the scripts to be ignored in read-only systems where the overall goal is for those scripts to be ignored altogether (aka systems that are set to read-only on purpose).

An alternative would be to provide an even more "minimal" version of the images that strips all the entrypoint scripts altogether, but I was trying to avoid adding yet another variant.

alessfg avatar Jul 20 '23 22:07 alessfg

In that case, wouldn't the simplest solution be to just skip the entrypoint altogether since it isn't providing anything except running the default command?

This one fails since it can't create var/cache/nginx/client_temp or /var/run/nginx.pid, which this PR can't really address:

$ docker run -d --read-only --entrypoint nginx nginx:[version] -g 'daemon off'

The only difference between these is a little extra output at the beginning, but both run nginx:

$ docker run -it --rm --read-only --tmpfs /var/cache/nginx/ --tmpfs /var/run/ --entrypoint nginx nginx -g 'daemon off;'
$ docker run -it --rm --read-only --tmpfs /var/cache/nginx/ --tmpfs /var/run/ nginx

yosifkit avatar Jul 21 '23 19:07 yosifkit