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



37
38
39
40
41
42
43
44
# File 'lib/docker/rails/ext/container.rb', line 37

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.



35
36
37
# File 'lib/docker/rails/ext/container.rb', line 35

def number
  @number
end

#oneoffObject (readonly)

Returns the value of attribute oneoff.



35
36
37
# File 'lib/docker/rails/ext/container.rb', line 35

def oneoff
  @oneoff
end

#projectObject (readonly)

Returns the value of attribute project.



35
36
37
# File 'lib/docker/rails/ext/container.rb', line 35

def project
  @project
end

#serviceObject (readonly)

Returns the value of attribute service.



35
36
37
# File 'lib/docker/rails/ext/container.rb', line 35

def service
  @service
end

#versionObject (readonly)

Returns the value of attribute version.



35
36
37
# File 'lib/docker/rails/ext/container.rb', line 35

def version
  @version
end

Class Method Details

.is_compose_container?(container) ⇒ Boolean



47
48
49
50
# File 'lib/docker/rails/ext/container.rb', line 47

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