I have a Docker container that should read logs, including those from the host itself. So I mount the volume /var/log
using the z
flag. This changes the SELinux context on the files inside /var/log
which prevents my usual processer from accessing these files, the end result being that I am unable to log in locally:
kernel: type=1400 audit(14958482): avc: denied { open } for pid=12345 comm="agetty" name="/var/log/wtmp" dev="dm-6" ino=134 scontext=system_u:system_r:getty_t:s0-s0:c0.c1023 tcontext=system_u:object_r:svirt_sandbox_file_t:s0 tclass=file
What's the best practice here? Turning off SELinux, while it gets rid of the issue, is not an option.