From 3686aecf0dfc24dffec6ecc98816c35308b9da7a Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Thu, 11 Mar 2021 15:08:00 -0500 Subject: [PATCH] Fix docker usage to use correct port and IP address on local docker --- lib/beaker/hypervisor/docker.rb | 3 ++- spec/beaker/hypervisor/docker_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/beaker/hypervisor/docker.rb b/lib/beaker/hypervisor/docker.rb index ec10655..cf98a3d 100644 --- a/lib/beaker/hypervisor/docker.rb +++ b/lib/beaker/hypervisor/docker.rb @@ -152,11 +152,12 @@ def get_ssh_connection_info(container) else port22 = network_settings.dig('Ports','22/tcp') ip = port22[0]["HostIp"] if port22 + port = port22[0]['HostPort'] if port22 end end if host_config['NetworkMode'] != 'slirp4netns' && network_settings['IPAddress'] && !network_settings['IPAddress'].empty? - ip = network_settings['IPAddress'] + ip = network_settings['IPAddress'] if ip.nil? else port22 = network_settings.dig('Ports','22/tcp') port = port22[0]['HostPort'] if port22 diff --git a/spec/beaker/hypervisor/docker_spec.rb b/spec/beaker/hypervisor/docker_spec.rb index 9019bab..a48d561 100644 --- a/spec/beaker/hypervisor/docker_spec.rb +++ b/spec/beaker/hypervisor/docker_spec.rb @@ -536,8 +536,8 @@ module Beaker ENV['DOCKER_HOST'] = nil docker.provision - expect( hosts[0]['ip'] ).to be === '192.0.2.1' - expect( hosts[0]['port'] ).to be === '22' + expect( hosts[0]['ip'] ).to be === '127.0.1.1' + expect( hosts[0]['port'] ).to be === 8022 end end