Class: Docker::Container
- Inherits:
-
Object
- Object
- Docker::Container
- Defined in:
- lib/docker/rails/ext/container.rb
Defined Under Namespace
Classes: Compose
Instance Method Summary collapse
- #compose ⇒ Object
- #down? ⇒ Boolean
- #exit_code ⇒ Object
- #name ⇒ Object
- #status ⇒ Object
- #up? ⇒ Boolean
Instance Method Details
#compose ⇒ Object
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
15 16 17 |
# File 'lib/docker/rails/ext/container.rb', line 15 def down? !up? end |
#exit_code ⇒ Object
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 |
#name ⇒ Object
3 4 5 |
# File 'lib/docker/rails/ext/container.rb', line 3 def name info['Names'][0].gsub(/^\//, '') end |
#status ⇒ Object
7 8 9 |
# File 'lib/docker/rails/ext/container.rb', line 7 def status info['Status'] end |
#up? ⇒ Boolean
11 12 13 |
# File 'lib/docker/rails/ext/container.rb', line 11 def up? status =~ /^(up|Up)/ end |