docker/pool/builder/lib/builder.rb
def confirm_running(container)
      ip = container[:ip]
      port = container[:port]

      tried_count = 1
      begin
        @logger.info "Checking application is ready... trying count:#{tried_count}"
        req = Net::HTTP.new(ip, port)
        res = req.get('/')
        unless res.kind_of?(Net::HTTPSuccess) or res.kind_of?(Net::HTTPRedirection)
          raise "Response status is not ready: #{res.code}"
        end
        @logger.info("Application is ready! forwarding to port #{port}")
        @log_device.notify_finished
      rescue => e
        @logger.info e
        if tried_count <= 30
          sleep 1
          tried_count += 1
          retry
        end
        raise
      end
    end
# Confirm container application is ready to get request via HTTP
# the container is not ready, wait and retry to send request
#
# TODO: need to set protocol, port and path by the user
Confirm container application is ready to get request via HTTP
the container is not ready, wait and retry to send request

need to set protocol, port and path by the user
Confirm container application is ready to get request via HTTP the container is not ready wait and retry to send request need to set protocol port and path by the user
def confirm_running(container)
      ip = container[:ip]
      port = container[:port]
      tried_count = 1
      begin
        @logger.info "Checking application is ready... trying count:#{tried_count}"
        req = Net::HTTP.new(ip, port)
        res = req.get('/')
        unless res.kind_of?(Net::HTTPSuccess) or res.kind_of?(Net::HTTPRedirection)
          raise "Response status is not ready: #{res.code}"
        end
        @logger.info("Application is ready! forwarding to port #{port}")
        @log_device.notify_finished
      rescue => e
        @logger.info e
        if tried_count <= 30
          sleep 1
          tried_count += 1
          retry
        end
        raise
      end
    end
def confirm_running ( container ) ip = container [ :ip ] port = container [ :port ] tried_count = 1 begin @logger . info "Checking application is ready... trying count:#{tried_count}" req = Net :: HTTP . new ( ip , port ) res = req . get ( '/' ) unless res . kind_of? ( Net :: HTTPSuccess ) or res . kind_of? ( Net :: HTTPRedirection ) raise "Response status is not ready: #{res.code}" end @logger . info ( "Application is ready! forwarding to port #{port}" ) @log_device . notify_finished rescue => e @logger . info e if tried_count <= 30 sleep 1 tried_count += 1 retry end raise end end
Confirm container application is ready to get request via HTTP
the container is not ready, wait and retry to send request
Confirm container application is ready to get request via HTTP the container is not ready wait and retry to send request
container