5 ms·
I recently switched to using both, docker running in a Vagrant VM. I've had several frustrating issues with boot2docker on OSX, it's generally just been less st
by dcosson 11y ago
I recently switched to using both, docker running in a Vagrant VM. I've had several frustrating issues with boot2docker on OSX, it's generally just been less stable for me than Vagrant.
In terms of using docker, IMO it's the best development experience I've come across once you get everything set up. It can be confusing to get your workflow set up at first, and it seems like everyone does it a little differently, I'm hoping that best practices will standardize a bit as docker continues to mature.
I love having every part of an app (app code, split into a few microservices if you wish, postgres, redis, rabbitmq, etc.) completely isolated, and docker-compose is a great system for linking things together. I also currently don't have any puppet/chef/etc code and love not having to maintain that, in my mind a large part of the need for configuration management tools is dealing with the complexity of diffing two arbitrary states of infrastructure, and with the immuatable approach of docker containers all that complexity disappears.
- vdaniuk 11y agoDid you manage to have automatic code reload set up with Vagrant/Docker? Last time I tried the following config: host folders shared with vagrant VM and vagrant folders mounted inside docker containers. Unfortunately, file change events on host didn't propagate to docker containers. As far as I remember, this was a limitation of Vagrant file system.
- NathanKP 11y agoI'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.
- cpuguy83 11y agoFilesystem events don't propagate across any networked filesystem (at least none that I've seen). FYI, vagrant is probably just using NFS. The default boot2docker setup uses vbox shared folders. Events should work just fine when they are on the same host (although currently overlayfs does not support inotify, so...)
- mahmoudimus 11y agore: boot2docker, I experienced the same issues as you and I found it even more annoying with little incompatibilities, etc. I actually did something simple with both Vagrant and Docker, I'm hoping to bundle it into a self-executable and have it as an alternative to boot2docker. Right now, it works only on OSX & Linux, but what it does is it uses Vagrant and builds a "docker-host" vm that you spin up manually (or you can just use a launchd script to spin it up on startup). Since Vagrant has great support for setting up a network bridge, I basically created a virtual private network between the host vm and my os. I set up the docker client running locally (brew install docker) and through the network bridge, it creates a pretty seamless experience. The beauty of Vagrant here is that I can customize the mem, cpu, etc. Vagrant also has rsync support (and rsync-auto!) and of course, great shared folder support with the docker image. I have experimental support to also create this experience on AWS, including spot instance support You can check it out here: https://github.com/mahmoudimus/docker-host-osx https://github.com/mahmoudimus/docker-host-osx.
- dnt404-1 11y agoI have been trying to setup docker, but the tutorials on the web seem not to be focused on active development (at the moment). Can you link to some documentations from where I can learn about the workflow and transitions from old way of doing things to the docker way?
- juliangregorian 11y agoI do the same, with the exception of docker-compose. What I have found to work for me is running mysql/memcached on the vagrant box and running docker with --net=host (in development). I deploy to Elastic Beanstalk with RDS and Elasticache though which contributes to my reluctance to completely set up multi-container configurations in docker-compose. My experience there has not been so smooth, would love to hear more about how people are doing that.