Write permissions on volume mount with security context fsgroup option

You’re troubleshooting file permissions. Remove your init container and try out the following. If you could provide this output it might also be useful in helping you.

Get a shell into the container.

kubectl exec -it POD_NAME -- sh

Confirm your uid and gid.

/ $ id
uid=1001 gid=1001 groups=1001

Test writing to the directory.

/ $ echo test > /opt/var/logs/docker/test.txt 
/ $ cat /opt/var/logs/docker/test.txt
test

Walk the directory and confirm permissions along the directory.

/ $ ls -lah /opt /opt/var /opt/var/logs /opt/var/logs/docker/
/opt:
total 12K    
drwxr-xr-x    1 root     root        4.0K Jun 30 14:06 .
drwxr-xr-x    1 root     root        4.0K Jun 30 14:06 ..
drwxr-xr-x    3 root     root        4.0K Jun 30 14:06 var

/opt/var:
total 12K    
drwxr-xr-x    3 root     root        4.0K Jun 30 14:06 .
drwxr-xr-x    1 root     root        4.0K Jun 30 14:06 ..
drwxr-xr-x    3 root     root        4.0K Jun 30 14:06 logs

/opt/var/logs:
total 12K    
drwxr-xr-x    3 root     root        4.0K Jun 30 14:06 .
drwxr-xr-x    3 root     root        4.0K Jun 30 14:06 ..
drwxrwsr-x    3 root     1001        4.0K Jun 30 14:07 docker

/opt/var/logs/docker/:
total 28K    
drwxrwsr-x    3 root     1001        4.0K Jun 30 14:07 .
drwxr-xr-x    3 root     root        4.0K Jun 30 14:06 ..
drwxrws---    2 root     1001       16.0K Jun 30 13:58 lost+found
-rw-r--r--    1 1001     1001           5 Jun 30 14:14 test.txt