lib/minke/docker/service_discovery.rb in minke-1.13.5 vs lib/minke/docker/service_discovery.rb in minke-1.13.6
- old
+ new
@@ -1,5 +1,7 @@
+require 'pry'
+
module Minke
module Docker
##
# ServiceDiscovery allows you to look up the publicly accessible address and port for a server
class ServiceDiscovery
@@ -19,11 +21,12 @@
# public address for the container e.g. 0.0.0.0:8080
def public_address_for service_name, private_port
begin
ip = @docker_runner.get_docker_ip_address
container_details = find_container_by_name "/#{@project_name}_#{service_name}_1"
+ #puts container_details
ports = container_details.first.info['Ports'].select { |p| p['PrivatePort'] == private_port.to_i }.first
- rescue
+ rescue Exception => e
raise "Unable to find public address for '#{service_name}' on port #{private_port}"
end
return "#{ip}:#{ports['PublicPort']}"
end