Search code examples
linuxdockerboot2dockerdockerfiledocker-toolbox

Docker permissios shared Volume on mac


I have a permission problem with my mac and my docker (VirtualBox).

container command:

docker run --name gbl -p 32770:80 -v /Users/sja/Sites/gbl:/var/www --link mariadb:db --link memcached:cache -td paimpozhil/magento-docker

After that I run a simple php script which create a txt file in my root directory.

$content = "some text here";
$fp = fopen($_SERVER['DOCUMENT_ROOT'] . "/myText.txt","wb");
fwrite($fp,$content);
fclose($fp);

The script not works because my php file have no permissions to create a new file.

PHP Warning:  fopen(/var/www/myText.txt): failed to open stream: Permission denied in /var/www/test.php on line 3

My username and group looks like this

enter image description here

When I try to change it to root nothing happens

chown root.root -R . 

enter image description here

What is wrong with my container and my permissions? It is possible that docker override my user and group because I use a shared folder?


Solution

  • Dinghy solve my problem! Works like a charm!

    https://github.com/codekitchen/dinghy