Class: Philae::DockerProbe

Inherits:
Object
  • Object
show all
Defined in:
lib/philae/docker_probe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, endpoint = '/var/run/docker.sock', options = nil) ⇒ DockerProbe

Returns a new instance of DockerProbe.



7
8
9
10
11
# File 'lib/philae/docker_probe.rb', line 7

def initialize(name, endpoint = '/var/run/docker.sock', options = nil)
  @name = name
  @endpoint = endpoint
  @docker_options = options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/philae/docker_probe.rb', line 5

def name
  @name
end

Instance Method Details

#checkObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/philae/docker_probe.rb', line 13

def check
  Docker.url = @endpoint
  Docker.options = @docker_options if !@docker_options.nil?
  begin
    Docker::Container.all
  rescue
    return { healthy: false, comment: 'Unable to communicate with docker' }
  end

  return { healthy: true, comment: '' }
end