Bertuz
Bertuz

Reputation: 2566

how to set file and dir permissions on docker when developing

I'm developing a symfony application with docker. I' sharing a host volume which it's supposed to contain my project that should be run with apache.

docker run -d -ti --name web -p 80:80 -v /Users/Matteo/Documents/em3:/var/www/html/applications  ubuntu /bin/bash

As a base image I've used ubuntu, on which I've installed apache and PHP7. Everything works, but when I enter into my docker:

docker exec -it web /bin/bash

root@85a23559d01b:/var/www/html/applications/auth# app/console cache:clear --env=dev


  [Symfony\Component\Filesystem\Exception\IOException]
  Failed to remove directory "/var/www/html/applications/auth/app/cache/de~/jms_serializer": .

This is maybe because the dir permissions?:

root@85a23559d01b:/var/www/html/applications/auth/app# ls -al | grep cache

drwxr-xr-x 1 1000 staff   374 Oct 30 21:50 cache

chmod does no change anything though:

root@85a23559d01b:/var/www/html/applications/auth/app# chmod g+w cache

root@85a23559d01b:/var/www/html/applications/auth/app# ls -al | grep cache
drwxr-xr-x 1 1000 staff   374 Oct 30 21:50 cache

I guess I'm missing something. Any help would be appreciated

Upvotes: 1

Views: 232

Answers (1)

VonC
VonC

Reputation: 1323633

As commented in symfony issue 2600

you can "easily" reproduce this if you use a Linux VirtualBox on a Windows host.

[And that might be the case here, using boot2docker from Docker Toolbox, instead of Docker for Windows and its Hyper-V]

cache:clear is never able to remove app/cache/dev_old - but that may be an issue with the shared folder system provided by VirtualBox (read about similar issues on their forums).

You have to upgrade VirtualBox Guest Additions

The OP Bertuz points out in the comments to "Changing boot2docker to use NFS for local mounts in OS X" and its file-nfs-mount-boot2docker-sh gist (and a more recent one).

Upvotes: 1

Related Questions