Class: Kitchen::Driver::Docker

Inherits:
SSHBase
  • Object
show all
Defined in:
lib/kitchen/driver/docker.rb

Overview

Docker driver for Kitchen.

Author:

Instance Method Summary collapse

Instance Method Details

#create(state) ⇒ Object


48
49
50
51
52
53
# File 'lib/kitchen/driver/docker.rb', line 48

def create(state)
  state[:image_id] = build_image(state) unless state[:image_id]
  state[:container_id] = run_container(state) unless state[:container_id]
  state[:hostname] = container_address(state) unless state[:hostname]
  wait_for_sshd(state[:hostname])
end

#destroy(state) ⇒ Object


55
56
57
58
59
60
# File 'lib/kitchen/driver/docker.rb', line 55

def destroy(state)
  rm_container(state) if state[:container_id]
  if config[:remove_images] && state[:image_id]
    rm_image(state)
  end
end

#verify_dependenciesObject


41
42
43
44
45
46
# File 'lib/kitchen/driver/docker.rb', line 41

def verify_dependencies
  run_command('docker > /dev/null', :quiet => true)
  rescue
    raise UserError,
    'You must first install Docker http://www.docker.io/gettingstarted/'
end