Centos 7 Samba php:apache Permission Denied when moving file with Docker container after moving to :z volume from samba share

Solution 1:

You moved files (without the -Z option) instead of copying them, so they carry their original SELinux contexts instead of the appropriate contexts for their destination.

When you created a new file, it had the correct SELinux context already.

You can use restorecon to fix the SELinux contexts on the affected files, for example:

restorecon -rv <directory>