Class: Dockerlib::Remote::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/dockerlib/remote/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(socket: nil) ⇒ Client

Returns a new instance of Client.



4
5
6
# File 'lib/dockerlib/remote/client.rb', line 4

def initialize(socket: nil)
  @socket = socket || '/var/run/docker.sock'
end

Instance Method Details

#inspect_container(name) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/dockerlib/remote/client.rb', line 8

def inspect_container(name)
  resp = connection.request(method: :get, path: "/containers/#{name}/json")
  if resp.status == 200
    {d: load_body(resp)}
  elsif resp.status == 404
    {code: :no_such_container}
  else
    to_server_error resp
  end
end