I want to use radicale with nginx inside a alpine based docker file. I am currently develop the Dockerfile and noticed a really strange behaivor, maybe somebody can explain this to me.
https://gist.github.com/cdpb/7ab1690f30fe6a911dac
docker run -it <id> sh
su radicale -c 'nginx -t'
:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] mkdir() "/var/lib/nginx/tmp/client_body" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed
ls -l /var/lib/nginx/tmp
:
total 20
drwxr-xr-x 2 radicale radicale 4096 Feb 17 11:39 client_body
drwxr-xr-x 2 radicale radicale 4096 Feb 17 11:39 fastcgi
drwxr-xr-x 2 radicale radicale 4096 Feb 17 11:39 proxy
drwxr-xr-x 2 radicale radicale 4096 Feb 17 11:39 scgi
drwxr-xr-x 2 radicale radicale 4096 Feb 17 11:39 uwsgi
su radicale -c 'nginx -t'
:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
so what happens after the ls
? it should not affect any permissions ... !? Can somebody reproduce this?
Regards
cdpb
UPDATE1: works also with stat /var/lib/nginx/tmp/*
UPDATE2: because docker creates a new layer for every command in Dockerfile, I thought that nginx has to be started within the same layer as the chmod/chown layer - didn't fix the problem
UPDATE3: I did the same with a disk installed alpine ( virtualbox ) and the problem didn't occur. So it's more a docker related problem or a special alpine docker one
Moving my answer from the comments.
Such weirdness is usually related to a Docker storage driver.
There are usually several available Docker storage drivers available on most OSes:
Here is a nice picture comparing different storage drivers from the link posted above.