class Docker::Stack::Container
Public Class Methods
new(id)
click to toggle source
# File lib/docker/stack/container.rb, line 10 def initialize(id) @id = id @container = Docker::Container.get(id) end
Public Instance Methods
service()
click to toggle source
# File lib/docker/stack/container.rb, line 15 def service info('Config', 'Labels', 'com.docker.compose.service') end
started()
click to toggle source
# File lib/docker/stack/container.rb, line 23 def started value = info('State', 'StartedAt') return value if value == 'unknown' Time.parse(value).utc end
status()
click to toggle source
# File lib/docker/stack/container.rb, line 19 def status info('State', 'Health', 'Status') end
to_h()
click to toggle source
# File lib/docker/stack/container.rb, line 34 def to_h { id: @id, service: service, status: status, started: started, running: uptime_in_words } end
uptime_in_words()
click to toggle source
# File lib/docker/stack/container.rb, line 29 def uptime_in_words return started if started == 'unknown' time_ago_in_words(started) end
Private Instance Methods
info(*keys)
click to toggle source
# File lib/docker/stack/container.rb, line 40 def info(*keys) result = @container.info keys.each { |key| result = result[key] } result end