brikis98 / docker-osx-dev

A productive development environment with Docker on OS X
http://www.ybrikman.com/writing/2015/05/19/docker-osx-dev/
MIT License
1.43k stars 106 forks source link

OSX rsync permission denied on file change #189

Open amlwwalker opened 8 years ago

amlwwalker commented 8 years ago

Rsync picks up the file change, but can't seem to delete some files:

2016-05-06 15:12:30 [INFO] rsync: delete_file: unlink(emailframework/node_modules/.bin/semver) failed: Permission denied (13)
2016-05-06 15:12:30 [INFO] rsync: delete_file: unlink(emailframework/node_modules/.bin/mime) failed: Permission denied (13)
2016-05-06 15:12:30 [INFO] rsync: delete_file: unlink(emailframework/node_modules/.bin/har-validator) failed: Permission denied (13)
2016-05-06 15:12:30 [INFO] cannot delete non-empty directory: emailframework/node_modules/.bin
2016-05-06 15:12:30 [INFO] rsync: delete_file: rmdir(emailframework/node_modules/.bin) failed: Permission denied (13)
2016-05-06 15:12:30 [INFO] cannot delete non-empty directory: emailframework/node_modules

...
...
...
2016-05-06 15:12:30 [INFO] rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1249) [sender=3.1.2]

Any ideas why?

Also, what will actually happen when the sync happens eventually in the contianer? I.e if I want to re start the application with the new changes how do you do that?

brikis98 commented 8 years ago

docker-osx-dev uses rsync to keep the folders on your host OS in sync with what's in the Docker container. If you add a file on your host OS, it'll add the same one in the Docker container. Similarly, if you remove a file on your host OS, it'll remove it in the Docker container. The catch is that rsync can't tell if a file was deleted locally or never existed in the first place; in either case, if it finds something in the Docker container that isn't on your host OS, it'll try to delete that file from the Docker container to keep things in sync.

My guess is that you ran npm install within your container, which creates a node_modules folder. Since you don't have the same folder on your host OS, rsync tries to delete it. However, it doesn't have permissions to do so, perhaps because some of those files in node_modules are in use.

Probably the best option is for you to tell docker-osx-dev to ignore the node_modules folder. You can do so with a .dockerignore file or with command line flags to docker-osx-dev (run it with the -h flag to see all options).