class Docktor::Runner

Constants

DEFAULT_YAML_PATH

Public Instance Methods

invoke( container_name: nil, yaml_path: DEFAULT_YAML_PATH, parser: Docktor::ManifestParser.new, client: Docktor::DockerClient.new ) click to toggle source
# File lib/docktor/runner.rb, line 10
def invoke(
  container_name: nil,
  yaml_path: DEFAULT_YAML_PATH,
  parser: Docktor::ManifestParser.new,
  client: Docktor::DockerClient.new
)
  manifest = parser.parse(yaml_path)

  manifest.select_container_for_execution(container_name) if container_name.present?

  manifest.containers_for_execution.each do |container|
    if client.container_exists?(container)
      client.start container
    else
      client.run container
    end
  end
rescue Docktor::Manifest::ContainerNotFound => e
  raise ContainerNotFound, e.message
end