Class: Flock::Sandbox::DockerStop

Inherits:
Object
  • Object
show all
Defined in:
lib/flock/sandbox.rb

Instance Method Summary collapse

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

#runObject



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