Merge pull request #8566 from chrisroberts/fix/docker-ssh

Fall back to old style ssh info lookup in docker provider
This commit is contained in:
Chris Roberts 2017-05-08 10:14:51 -07:00 committed by GitHub
commit ffc6e3e282
1 changed files with 13 additions and 2 deletions

View File

@ -137,9 +137,20 @@ module VagrantPlugins
return nil if state.id != :running
port_name = "#{@machine.config.ssh.guest_port}/tcp"
network = driver.inspect_container(@machine.id)['NetworkSettings']
port_info = network['Ports'][port_name].first
if network["Ports"][port_name].respond_to?(:first)
port_info = network["Ports"][port_name].first
else
ip = network["IpAddress"]
port = @machine.config.ssh.guest_port
if !ip.to_s.empty?
port_info = {
"HostIp" => ip,
"HostPort" => port
}
end
end
# If we were not able to identify the container's IP, we return nil
# here and we let Vagrant core deal with it ;)