Class: Kontena::Plugin::Local::RemoveCommand
- Inherits:
-
Command
- Object
- Command
- Kontena::Plugin::Local::RemoveCommand
- Includes:
- Cli::Common
- Defined in:
- lib/kontena/plugin/local/remove_command.rb
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/kontena/plugin/local/remove_command.rb', line 8 def execute confirm_command('local-kontena') unless forced? remove_container('kontena-master-api') remove_container('kontena-master-mongo') remove_container('kontena-agent') remove_container('kontena-ipam-plugin') remove_container('kontena-etcd') remove_container('kontena-etcd-data') remove_container('kontena-cadvisor') remove_container('weave') remove_container('kontena-registry') remove_volume('kontena-master-db') Kontena.run('master rm --force --silent local-kontena') end |
#remove_container(name) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/kontena/plugin/local/remove_command.rb', line 26 def remove_container(name) container = Docker::Container.get(name) rescue nil if container spinner "Removing #{name}" do container.delete(force: true) end end end |
#remove_volume(name) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/kontena/plugin/local/remove_command.rb', line 35 def remove_volume(name) volume = Docker::Volume.get(name) rescue nil if volume spinner "Removing volume #{name}" do volume.remove end end end |