Class: Sidedock::Image

Inherits:
Base
  • Object
show all
Defined in:
lib/sidedock/image.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#machine, machine

Constructor Details

#initialize(id) ⇒ Image

Returns a new instance of Image.



5
6
7
# File 'lib/sidedock/image.rb', line 5

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/sidedock/image.rb', line 3

def id
  @id
end

Class Method Details

.build(dockerfile_path) ⇒ Object



18
19
20
21
# File 'lib/sidedock/image.rb', line 18

def self.build(dockerfile_path)
  built_id = machine.execute "build -q #{dockerfile_path}"
  new built_id
end

Instance Method Details

#removeObject



9
10
11
12
# File 'lib/sidedock/image.rb', line 9

def remove
  remove_containers_using_it
  machine.execute "rmi -f #{@id}"
end

#remove_containers_using_itObject



14
15
16
# File 'lib/sidedock/image.rb', line 14

def remove_containers_using_it
  Container.using_image(self).each(&:remove)
end