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.



55
56
57
58
59
60
61
62
# File 'lib/docker/rails/ext/container.rb', line 55

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.



53
54
55
# File 'lib/docker/rails/ext/container.rb', line 53

def number
  @number
end

#oneoffObject (readonly)

Returns the value of attribute oneoff.



53
54
55
# File 'lib/docker/rails/ext/container.rb', line 53

def oneoff
  @oneoff
end

#projectObject (readonly)

Returns the value of attribute project.



53
54
55
# File 'lib/docker/rails/ext/container.rb', line 53

def project
  @project
end

#serviceObject (readonly)

Returns the value of attribute service.



53
54
55
# File 'lib/docker/rails/ext/container.rb', line 53

def service
  @service
end

#versionObject (readonly)

Returns the value of attribute version.



53
54
55
# File 'lib/docker/rails/ext/container.rb', line 53

def version
  @version
end

Class Method Details

.is_compose_container?(container) ⇒ Boolean

Returns:

  • (Boolean)


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

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