Hi Alvaro, Thanks again for this: I think I understand the thinking behind this. I have created a separate Vagrantfile as you suggested and linked to it from my main Vagrantfile.
However, when I “vagrant up” now I get the following confusing error message about ports that I am not mapping … Vagrant cannot forward the specified ports on this VM, since they would collide with some other application that is already listening on these ports. The forwarded port to 2375 is already in use on the host machine. I did a vagrant destroy before doing the up - so I don’t think it has anything to do with an existing VM that is running … I am not sure where it is getting the 2375 port from …. Jörg > On 08 Jun 2015, at 11:31 AM, Alvaro Miranda Aguilera <[email protected]> > wrote: > > Hello, > > Have a look at the attached file, but basically is like this: > > in your Vagrantfile, you need to tell what Vagrantfile use to spin a > docker host. > > As you are using boot2docker, and seems it works for you, I leave it: > > cat jd/Vagrantfile > > Vagrant.require_version ">= 1.6.0" > ENV['VAGRANT_DEFAULT_PROVIDER'] = 'docker' > Vagrant.configure("2") do |config| > config.vm.synced_folder ".", "/vagrant", type: "rsync", > rsync__exclude: ".git/", disabled: false > config.vm.provider "docker" do |docker| > docker.vagrant_vagrantfile = "../boot2docker/Vagrantfile" > docker.image = "rabbitmq:3-management" > docker.ports = ['5672:5672', '15672:8080'] # guest:container > docker.name = 'rabbitmq' > docker.create_args = ['-e', 'RABBITMQ_NODENAME=johnny-is-a-rabbit'] > end > config.ssh.insert_key = false > end > > > Check the first line inside the docker block > > > Then you define your docker host, and here is where you need to do all > the extra work: > > cat boot2docker/Vagrantfile > > Vagrant.configure(2) do |config| > config.vm.box = "mitchellh/boot2docker" > config.vm.network "forwarded_port", guest: 5672, host: 5672 > end > > > So, on the first Vagrantfile, you do the mapping between guest and > docker container > on the second one you can use host to docker host > > hope this helps > > Thanks > Alvaro. > > -- > You received this message because you are subscribed to a topic in the Google > Groups "Vagrant" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/vagrant-up/GcbTei30yUM/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > <docker_sample.zip> -- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
