Docker Apache: 'chmod: changing permissions of "file" Operation not permitted' Docker Apache: 'chmod: changing permissions of "file" Operation not permitted' kubernetes kubernetes

Docker Apache: 'chmod: changing permissions of "file" Operation not permitted'


I also should mention the application is using Azure file service as the persistent volume.

That's the problem. Azure Files provides a CIFS share, which is mounted under Linux as a cifs mount. CIFS shares do not provide UNIX type file permissions and UNIX type uid/gid storage.

When mounting the CIFS share, the Linux machine uses a username/password to authenticate at the CIFS server. Every access through this mount will actually use this username on the CIFS server, regardless of which UNIX user is initiating the file system operations. According to this GitHub issue, Azure Files does not support UNIX extensions, and that means that the Linux client would have to emulate UNIX uid/gid & permissions. The server does not store or supply these parameters. So at mount time, you have to add uid, gid, file_mode and dir_mode parameters to set these data.

If you are using OS level CIFS mounts (through /etc/fstab), or manual CLI mount commands, you have to add these options to the mount command (see man mount.cifs).

Eg: mount -t cifs -o file_mode=0644,dir_mode=0755,uid=80,gid=80 ...

If you are using Kubernetes volumes, you have to add these options to the volume parameters (see Azure Files share in Kubernetes).

Eg:

apiVersion: v1kind: PersistentVolumemetadata:  name: azurefilespec:  capacity:    storage: 5Gi  accessModes:    - ReadWriteMany  storageClassName: azurefile  azureFile:    secretName: azure-secret    shareName: aksshare    readOnly: false  mountOptions:  - dir_mode=0755  - file_mode=0644  - uid=80  - gid=80  - mfsymlinks