Thanks a lot for the response, Alvaro,

Let me throw a couple things at you:

I normally do all my work in a Linux VirtualBox guest within my 
(company-supplied) Windows host. I'd prefer to have a Linux host, but it is 
what it is.

I needed to create a consistent development environment to share with my 
team, and I found Vagrant.

When I started with Vagrant a short time ago, I started out trying to run 
Vagrant commands within my guest, but quickly found that VirtualBox doesn't 
support nested VMs, so that was a brick wall. Then I resorted to running 
the Vagrant commands on the Windows host. That worked: I was able to spin 
up and provision a box on-the-fly, create a host-only network, and connect 
to the development site via a static host-only IP and a hosts entry. 
However, I was still sad that I had to do my Vagrant development on Windows.

Then, I discovered Docker, and I realized that it might be possible to work 
within my preferred Linux VM by using the Docker provider in there (to get 
around the nested VM problem). So, that's what I'm working through at the 
moment.

You mentioned potentially forcing the use of a proxy VM, but due to the 
reasons I mentioned, it's not preferable. I'd like to come up with a 
solution that will work both from my Linux VM, and my other teammates' 
Windows & Mac boxes. (In other words the ideal scenario would be to have 
Vagrant automatically use Docker right in my Linux environment, but 
automatically use a proxy on the Windows and Mac boxes.)

So, combining the things you mentioned with my requirements:

Must I do port forwarding/mapping (or whatever it's called) to map the 
container's port 443 to some other port on the host (which happens to be a 
VM itself)? If I have to do that, what's the technical reason for that? Is 
it just because Docker won't do static IPs, and therefore a hosts entry 
would get invalidated every time I brought up the container?

I hope I made sense and haven't bored everyone to death.

Thanks,
Jamie

On Friday, October 3, 2014 6:31:23 PM UTC-4, Alvaro Miranda Aguilera wrote:
>
> Hello
>
> you need to glue 2 things.
>
> glue1,
>
> you can force to always use a proxy linux box, in that case your linux box 
> will be the same as win or mac
>
> by default, a new vm will be fired up, and a docker container will run 
> inside.
> the simple approach is just 1 vagrantfile for the docker, here you do 
> vagrant up and vagrant does the magic
>
> now, you can get a bit more in control of this, a have 2 vagrantfiles, one 
> for the base host where docker will run, and one for the docker it self
>
> in the documentation, have a look around here:
>
> https://docs.vagrantup.com/v2/docker/basics.html
>
> Read about the host VM
>
> basically you define a vagrantfile that will be used for this host:
>
>   config.vm.provider "docker" do |d|
>     d.vagrant_vagrantfile = "../path/to/Vagrantfile"
>   end
>
> Here, let me say it again, with this you get more control on your base 
> box, so you would be able to specify the base box, provider, and scripts to 
> provision.
>
> glue2.
>
> In the docker file you can expose ports, so you can run a web server 
> expose 80 on the docker to 80 on the host (vm)
>
> then on the vagrantfile of that box, you can expost that 80 to the real 
> host as say 8080
>
> Docker 80 -> vm 80 -> real pc 8080
>
> make any sense?
>
> The docker way to do it is you expose ports to the base host.
>
>
> On Fri, Oct 3, 2014 at 5:29 PM, Jamie Jackson <[email protected] 
> <javascript:>> wrote:
>
>> Hi Folks,
>>
>> I'm pretty new to Vagrant, but I managed to create a VirtualBox VM with 
>> an app stack and an auto-populated Maria DB, which I'll be able to share 
>> with other developers on the team just by giving them a directory with a 
>> Vagrantfile and included shell provisioner scripts.
>>
>> Just today, I started playing with switching the provider over to Docker. 
>> That's had some snags along the way, but I think most of it is worked out. 
>> However, one thing I'm used to with the VirtualBox provider is being able 
>> to specify a static IP for the VM for host-only communication:
>>
>>
>> config.vm.network :private_network, ip: "192.168.56.10"
>>
>>
>> Then, I can simply have a permanent host entry of:
>>
>> 192.168.56.10 local.mysite.com
>>
>>
>> I haven't figured out how to do the same with the Docker provider. [It 
>> assigns the IP dynamically, and it seems to change for some (maybe all) 
>> vagrant ups.]
>>
>> How do I accomplish this sort of thing with the Docker provider? For what 
>> it's worth, I'm developing the Vagrant project on Linux, but it will be 
>> also used by teammates on Macs and Windows.
>>
>> Thanks,
>> Jamie
>>
>> -- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.

Reply via email to