4 ms·
I'm using the same setup and it works great. Vagrant shares a host folder into the guest VM, and then the docker containers mount subfolders of that shared fold
by NathanKP 11y ago
I'm using the same setup and it works great. Vagrant shares a host folder into the guest VM, and then the docker containers mount subfolders of that shared folder into the container.
So you change a file on the host computer, and it reflects automatically inside the guest VM which is the docker host, and automatically inside the containers since that same location is mounted by the containers.
I just checked the Vagrantfile, and the Ansible playbook we use to launch the docker containers, and I don't see any special magic required to get the syncing working with the Vagrant filesystem, it just works out of the box.
- kalmi10 11y agoDon't you lose inotify this way? Most autoreload solutions trigger on inotify events.
- NathanKP 11y agoNo, it works fine for me. The node.js livereload code running inside the container can detect the file changes just fine, and it just alerts the browser running on my host computer via a port that has been forwarded from inside the container to the docker host, and from the docker host to the VM host. And by the way this setup is bidirectional. If code inside my container, or an SSH session running inside my container makes a disk change, that change is also reflected on the version of the folder that runs on the host. So if you don't want to go through the effort of doing the port forwarding, you can run live reload on your host machine, and reload the browser automatically in response to changes that were made by the container.
- dcosson 11y agoYup, this is what I do as well. No special configuration was required as far as I know, either.