Class: Conjure::Provision::Docker::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/conjure/provision/docker/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(docker_host, image_name) ⇒ Image

Returns a new instance of Image.



7
8
9
10
# File 'lib/conjure/provision/docker/image.rb', line 7

def initialize(docker_host, image_name)
  @docker_host = docker_host
  @name = image_name
end

Instance Attribute Details

#image_nameObject (readonly)

Returns the value of attribute image_name.



5
6
7
# File 'lib/conjure/provision/docker/image.rb', line 5

def image_name
  @image_name
end

Instance Method Details

#start(command, options = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/conjure/provision/docker/image.rb', line 12

def start(command, options = {})
  container_id = @docker_host.started_container_id @name, command, options[:run_options]
  sleep 2
  ip_address = @docker_host.container_ip_address container_id
  raise "Container failed to start" unless ip_address.present?
  ip_address
end