Class: Docker::Container::Compose

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container) ⇒ Compose

Returns a new instance of Compose.



63
64
65
66
67
68
69
70
# File 'lib/docker/rails/ext/container.rb', line 63

def initialize(container)
  labels = container.info['Labels']
  @service = labels['com.docker.compose.service']
  @project = labels['com.docker.compose.project']
  @oneoff = !!labels['com.docker.compose.oneoff']
  @number = labels['com.docker.compose.container-number'].to_i
  @version = labels['com.docker.compose.version']
end

Instance Attribute Details

#numberObject (readonly)

Returns the value of attribute number.



61
62
63
# File 'lib/docker/rails/ext/container.rb', line 61

def number
  @number
end

#oneoffObject (readonly)

Returns the value of attribute oneoff.



61
62
63
# File 'lib/docker/rails/ext/container.rb', line 61

def oneoff
  @oneoff
end

#projectObject (readonly)

Returns the value of attribute project.



61
62
63
# File 'lib/docker/rails/ext/container.rb', line 61

def project
  @project
end

#serviceObject (readonly)

Returns the value of attribute service.



61
62
63
# File 'lib/docker/rails/ext/container.rb', line 61

def service
  @service
end

#versionObject (readonly)

Returns the value of attribute version.



61
62
63
# File 'lib/docker/rails/ext/container.rb', line 61

def version
  @version
end

Class Method Details

.is_compose_container?(container) ⇒ Boolean

Returns:

  • (Boolean)


73
74
75
76
# File 'lib/docker/rails/ext/container.rb', line 73

def is_compose_container?(container)
  labels = container.info['Labels']
  (!labels.nil? && !labels['com.docker.compose.version'].nil?)
end