A
A
Andrey Baranichenko2015-08-10 20:35:07
Vagrant
Andrey Baranichenko, 2015-08-10 20:35:07

How to run multiple vagrant boxes?

I do this, there are 2 folders, in one I do vagrant init laravel/homestead in the other vagrant init precise32 , i.e. I want to run 2 different boxes. these boxes are already in the vagrant, then I start any of the machines, one of the machines will appear in the virtualbox machine pack (the one I launched), for example precise32 , if I run it in the second folder (vagrant up, I want to run laravel/homestead in parallel) it will say that the machine is running, i.e. the second virtual box is not created in the virtualbox folder. what am I doing wrong?
As for the fact that I’m not running homestead according to Feng Shui, I know, but at the moment it doesn’t matter, however, the second one is launched through homestead ..
I suspect that the dog has been rummaging around here:
Bringing machine ' default ' up with 'virtualbox' provider...
==> default: VirtualBox VM is already running.
That is, the machine that I start first becomes default and it doesn’t matter that config.vm.box = "laravel/homestead" is specified in the Vagrantfile, the default (precise32) machine will still start, the one that started first .. If you put it out, then the second, where config.vm.box = "laravel/homestead" is specified in the Vagrantfile, it will still raise precise32
How to get around this?
UPD:
Posting my Vagrantfile, what I came up with after some thought and studying the docks
# -*- mode: ruby ​​-*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box_check_update = false
config.vm.synced_folder "./data", "/vagrant"
config.vm.network "forwarded_port", guest: 22, host: 2222, id: "ssh", disabled: true
config.vm.define "homestead", autostart: false
# config.vm.boot_timeout = "600"
# config .vm.provider "virtualbox" do |vb|
# vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
# end
######################### #precise#############################################
config.vm .define :precise do |precise|
precise.vm.box = "precise32"
# precise.vm.hostname = "precise.dev"
precise.vm.network "private_network", ip: "192.168.100.110"
precise.vm.network "forwarded_port", guest: 22, host:
precise.vm.synced_folder "./data/precise", "/vagrant/precise"
# precise.vm.provider "virtualbox" do |vb|
# vb.gui = false
# vb.name = "Precise"
# vb.cpus = 2
# vb.memory = "512"
# end
end
################### #########homestead######################################## ####
config.vm.define :homestead do |homestead|
homestead.vm.box = "laravel/homestead"
# homestead.vm.hostname = "homestead.dev"
homestead.vm.network "private_network", ip: "192.168.100.120"
homestead.vm.network "forwarded_port", guest: 22, host: 4444, id: "ssh",
homestead.vm.synced_folder "./data/homestead", "/vagrant/homestead"
# homestead.vm.provider "virtualbox" do |vb|
# vb.gui = false
# vb.name = "Homestead"
# vb.cpus = 2
# vb.memory = "1024"
# end
end
################### ################################################### ###
end
vagrant up raises the machine precise
vagrant up precise raises precise
vagrant up homestead raises homestead
Commented lines are only needed for the first run or for changing the configuration of virtual machines, such as starting with Gui or changing the number of memory processors, etc.
But, if, for example, do vagrant suspend precise
and then vagrant resume, then both will start even if the second one was not saved, but these are already trifles

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Baranichenko, 2015-08-27
@burick

Updated the question, added my Vagranfile, maybe someone will be interested

D
Dmitry Lezhnev, 2015-09-24
@dimalez

I have a post in addition to the topic on several vagrant(homestead) machines: dimalezhnev.ru/2015/09/24/vagrant-homestead

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question