Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker usage to use correct port and IP address on local docker #44

Merged
merged 1 commit into from
Mar 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/beaker/hypervisor/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/beaker/hypervisor/docker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down