Class: Kitchen::Driver::Docker
- Inherits:
-
SSHBase
- Object
- SSHBase
- Kitchen::Driver::Docker
- Defined in:
- lib/kitchen/driver/docker.rb
Overview
Docker driver for Kitchen.
Instance Method Summary collapse
- #create(state) ⇒ Object
- #default_image ⇒ Object
- #default_platform ⇒ Object
- #destroy(state) ⇒ Object
- #verify_dependencies ⇒ Object
Instance Method Details
#create(state) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/kitchen/driver/docker.rb', line 60 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] = remote_socket? ? socket_uri.host : 'localhost' state[:port] = container_ssh_port(state) wait_for_sshd(state[:hostname], :port => state[:port]) end |
#default_image ⇒ Object
51 52 53 54 |
# File 'lib/kitchen/driver/docker.rb', line 51 def default_image platform, release = instance.platform.name.split('-') release ? [platform, release].join(':') : 'base' end |
#default_platform ⇒ Object
56 57 58 |
# File 'lib/kitchen/driver/docker.rb', line 56 def default_platform instance.platform.name.split('-').first || 'ubuntu' end |
#destroy(state) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/kitchen/driver/docker.rb', line 68 def destroy(state) rm_container(state) if state[:container_id] if config[:remove_images] && state[:image_id] rm_image(state) end end |
#verify_dependencies ⇒ Object
44 45 46 47 48 49 |
# File 'lib/kitchen/driver/docker.rb', line 44 def verify_dependencies run_command('docker > /dev/null', :quiet => true) rescue raise UserError, 'You must first install Docker http://www.docker.io/gettingstarted/' end |