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

Where did it sync my files? #180

Open sydekumf opened 8 years ago

sydekumf commented 8 years ago

I am running DockerTools and I have the following mounting of directories in docker-compose.yml:

volumes:
    - "./www:/var/www"

Following your documentation, it says, just run docker-osx-dev. It synced a lot of files, here is one line of syncing (all the rest looks the same):

`2016-03-17 21:24:05 [INFO] Syncing www/vendor/zendframework/zend-view/src/Model/: cd+++++++``

SSH-ing into my docker container I would have expected to find the sources under /var/www. But this folder was empty, even if there have been files before in it :-) My application also does not run as the folder is empty :-) So it seems the rsync deleted the files? Why doesn't it output where it syncs them to? Right now I am not sure how to use your script.

brikis98 commented 8 years ago

Please run docker-osx-dev with the debug flag and paste the full output here. Thanks!

sydekumf commented 8 years ago

Before I do this I have a general question of understanding: How does docker-osv-dev know where to sync my files into the container?

Edit: So i looked into the debug messages and found out that the tool syncs directly into my VM? [DEBUG] Creating parent directories in Docker VM: If I login via SSH in to my VM I can see the files at the exact same path as on my local OSX. Did I misunderstand the meaning of the tool? I thought it would sync into my container? Why VM? I develop on my container :-)

brikis98 commented 8 years ago

Both docker-osx-dev, and vboxsf, copy the files into the exact same path on the VM. That way, docker's normal volume mounting options (-v) actually work, since docker itself runs in the VM as well. So if you have /foo:/bar in your docker-compose.yml, what happens is:

  1. When you run docker-osx-dev, it uses rsync to copy the contents of /foo into the exact same /foo path on the VM.
  2. When you run docker-compse up, it mounts /foo from the VM into the /bar path of the Docker container.
sydekumf commented 8 years ago

Thanks for the detailed explanations. Now I understand :-) I have further questions: Can the following question always be answered with yes automatically when running docker-osx-dev the first time so you can use it in automatic scripts without user interaction?

2016-03-20 12:38:49 [ERROR] Found VirtualBox shared folders on your Boot2Docker VM. These may void any performance benefits from using docker-osx-dev: /Users 2016-03-20 12:38:49 [INSTRUCTIONS] Would you like this script to remove them? 1) yes 2) no

Although I answered with yes I still had shared folders in my Virtual Box Manager which I had to delete manually. What does the command do in the background if I say yes?

brikis98 commented 8 years ago

If you enter yes, it should unmount the folders using the umount_vboxsf_mounted_folder function, including logging each folder it is unmounting. Are you seeing that log output?

To set that value to yes automatically, use the --remove-shared-folders flag. See docker-osx-dev -h for all flags.

ain commented 8 years ago

I've just tested, -r works seamlessly.

sicdigital commented 7 years ago

@sydekumf did you ever get this sorted? I'm seeing my files being synced in my VM at the same location as my local machine, but they are not appearing in my container.

I actually found everything to be working fine when using the sample. For some reason I'm not syncing my own project.