I'm trying to run Nginx as the docker container on SELinux enabled server with mounted configuration as
That works fine till I will deploy updated configuration using ansible playbook (user/group root and mode 0644) as
tasks: - name: remove NGINX conf file: path: "/host/path/nginx.conf" state: absent become: true - name: copy NGINX conf become: true copy: src: "../nginx-conf/nginx.conf" dest: "/host/path/nginx.conf" mode: 0640 owner: root group: root
and then reload nginx in the container as
docker container exec nginx-service nginx -s reload
that will error out with Permission Denied (13) to deployed configuration.
When I will check permissions to
/host/path/nginx.conf those are correct (user/group:root and mode 0644) but for some reason nginx is not able to read that file.
When I will get inside the container and check
/etc/nginx/nginx.conf permissions there are not carried over - they show up as question marks.
Any clue how to get it to work without reloading whole container just nginx service?
stat output inside the container before deployment:
File: /etc/nginx/nginx.conf Size: 247 Blocks: 8 IO Block: 4096 regular file Device: fd00h/64768d Inode: 25461574 Links: 1 Access: (0640/-rw-r-----) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2020-12-02 15:30:59.453867402 +0000 Modify: 2020-12-02 15:30:56.611769825 +0000 Change: 2020-12-02 15:30:56.937781018 +0000 Birth: -
stat output after deployment:
stat: cannot stat '/etc/nginx/nginx.conf': Permission denied
and ls -la on that folder:
drwxr-xr-x. 2 root root 30 Dec 2 16:11 . drwxr-xr-x. 1 nginx nginx 215 Dec 2 16:00 .. -?????????? ? ? ? ? ? nginx.conf