Ls: cannot open directory '.': Permission Denied

Hi guys,

I’m using a sonarqube analyzer of my own that I’d like to dockerize it. My problem is that, sonarqube doesn’t have enough privilege to read and write in the Docker volume shared with the host.

I’ve chowned sonarqube on the folder using thi scommand :

chown sonarqube:sonarqube /media/shared

But stil, when i do su sonarqubeand ls it returns :

ls: cannot open directory '.': Permission denied

I found on stackoverflow a similar issue due to several containers sharing the same volume. The tips included in it of using chcon -Rt <user> <path>do not work in my situation as I get the following return :

chcon: failed to change context of 'coverages-350.pb' to ‘system_u:object_r:sonarqube:s0’: Operation not supported

I also tried to use the :ro :z options, but not helping.

My last attempt, was to try to add sonarqube in root group, but, still, sadly not working.

Do you have any idea how to gives privileges to this service to write and read on the volume ?


I’m not sure my conclusion is the best one, but this seems to be the solution of my problem.

I’m using Docker on a virtual machine. Doing ls -lrton the host file shown me that in fact, the owner of files shared to the volume were owned by root:vbox while the root running the volume was root:root. Using a chown -Rt user:useron the host files shared with the container before running it solved the issue.