diff --git a/CHANGELOG.md b/CHANGELOG.md index aa2d99c34..0f6ed6771 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ BUG FIXES: capture the final image. [GH-4598] - providers/docker: NFS synced folders now work. [GH-4344] - providers/docker: Read the created container ID more robustly. + - providers/docker: `vagrant share` uses correct IP of proxy VM if it + exists. [GH-4342] - providers/virtualbox: Show a human-friendly error if VirtualBox didn't clean up an existing VM. [GH-4681] - provisioners/docker: Search for docker binary in multiple places. [GH-4580] diff --git a/plugins/providers/docker/cap/public_address.rb b/plugins/providers/docker/cap/public_address.rb index 379b0452b..987cd668c 100644 --- a/plugins/providers/docker/cap/public_address.rb +++ b/plugins/providers/docker/cap/public_address.rb @@ -5,6 +5,14 @@ module VagrantPlugins def self.public_address(machine) return nil if machine.state.id != :running + # If we're using a host VM, then return the IP of that + # rather than of our own machine. + if machine.provider.host_vm? + host_machine = machine.provider.host_vm + return nil if !host_machine.provider.capability?(:public_address) + return host_machine.provider.capability(:public_address) + end + ssh_info = machine.ssh_info return nil if !ssh_info ssh_info[:host]