Class: Docker::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/docker/rails/ext/container.rb

Defined Under Namespace

Classes: Compose

Instance Method Summary collapse

Instance Method Details

#composeObject



29
30
31
32
# File 'lib/docker/rails/ext/container.rb', line 29

def compose
  return nil unless Compose.is_compose_container?(self)
  @_compose ||= Compose.new(self)
end

#down?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/docker/rails/ext/container.rb', line 15

def down?
  !up?
end

#exit_codeObject



19
20
21
22
23
24
25
26
27
# File 'lib/docker/rails/ext/container.rb', line 19

def exit_code
  return nil if up?
  return nil unless (status =~ /xited/)

  #  Up 10 seconds
  #  Exited (0) 2 seconds ago
  status =~ /^.* \((\w+)\)/
  $1.to_i
end

#nameObject



3
4
5
# File 'lib/docker/rails/ext/container.rb', line 3

def name
  info['Names'][0].gsub(/^\//, '')
end

#statusObject



7
8
9
# File 'lib/docker/rails/ext/container.rb', line 7

def status
  info['Status']
end

#up?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/docker/rails/ext/container.rb', line 11

def up?
  status =~ /^(up|Up)/
end