dduportal / boot2docker-vagrant-box

Packer scripts to build a Vagrant-compatible boot2docker box.
85 stars 32 forks source link

add default network id to vagrantfile #6

Closed Freyskeyd closed 9 years ago

Freyskeyd commented 9 years ago

Hey,

If we don't have an id on config.vm.network we can't override it.

# Root vagrant file
config.vm.network "private_network", ip: "192.168.10.10"

# Client vagrant file
config.vm.network "private_network", ip: "192.168.10.69"

So, if i define a private_network as 192.168.10.69, docker will not generate certificates for 192.168.10.69.

We don't want that.

if we simply add:

config.vm.network "private_network", ip: "192.168.10.69", id: "default-network"

Certificates are well generated with the right network addr.

Ps: We need to try it with other networks too. Didn't have time now but maybe soon.

dduportal commented 9 years ago

Thanks !

benjy commented 9 years ago

I just upgraded and I have a problem in a similar area to this issue. Basically, the Vagrant box IP address randomly changes from the IP I set in my Vagrantfile back to the 192.168.56.101

I say randomly because i've not come up with a reliable way to reproduce it other than, wait 10-20 minutes.

Here's my Vagrant file:

Vagrant.configure(2) do |config|
    config.vm.box = "dduportal/boot2docker"
    # Set SSH credentials.
    config.ssh.shell = "sh"
    config.ssh.username = "docker"

    # Used on Vagrant >= 1.7.x to disable the ssh key regeneration
    config.ssh.insert_key = false

    # Expose the Docker ports (non secured AND secured)
    config.vm.network "forwarded_port", guest: 2375, host: 2375, host_ip: "127.0.0.1", auto_correct: true, id: "docker"
    config.vm.network "forwarded_port", guest: 2376, host: 2376, host_ip: "127.0.0.1", auto_correct: true, id: "docker-ssl"

    # Forward xdebug ports back to the host.
    config.vm.network "forwarded_port", guest: 9000, host: 9001

    # Set static IP
    config.vm.network "private_network", ip: "192.168.33.10", id: "default-network"

    # Add bootlocal support
    if File.file?('./bootlocal.sh')
        config.vm.provision "shell", path: "bootlocal.sh", run: "always"
    end

    # Setup the user mapping for NFS.
    config.nfs.map_uid = Process.uid
    config.nfs.map_gid = Process.gid

    # Map some NFS shares.
    config.vm.synced_folder "/Users", "/Users", type: "nfs", mount_options: ["nolock", "vers=3", "udp"]
    config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ["nolock", "vers=3", "udp"]
end

Not sure what causes the Vagrant IP change, if it matters, we're using docker within the vm. I can still SSH into the vagrant machine after the IP changes, however if I have a current SSH session, that gets disconnected and I have to re-connect (as you'd expect).