Class: Flock::Sandbox::DockerStop
- Inherits:
-
Object
- Object
- Flock::Sandbox::DockerStop
- Defined in:
- lib/flock/sandbox.rb
Instance Method Summary collapse
-
#initialize(definition) ⇒ DockerStop
constructor
A new instance of DockerStop.
- #run ⇒ Object
Constructor Details
#initialize(definition) ⇒ DockerStop
Returns a new instance of DockerStop.
132 133 134 |
# File 'lib/flock/sandbox.rb', line 132 def initialize(definition) @definition = definition end |
Instance Method Details
#run ⇒ Object
136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/flock/sandbox.rb', line 136 def run @definition.containers.each do |c| cont = begin ::Docker::Container.get(c[:name]) rescue ::Docker::Error::NotFoundError end next unless c puts "Stop #{c[:name]}" cont.kill cont.delete end end |