Method: Dockit::Service#start

Defined in:
lib/dockit/service.rb

#start(options) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/dockit/service.rb', line 22

def start(options)
  opts = merge_config(:create, stringify(options[:create]))
  unless image || opts['Image']
    raise "No runnable image found or specified!"
  end

  opts['Image'] ||= image.id if image
  opts['name']  ||= config.get(:build, :t)

  run = merge_config(:run, stringify(options[:run]))

  if options[:verbose]
    cmd = [(opts['Entrypoint']||[]), ((opts['Cmd'] || %w[default]))].flatten
    puts " * %s (%s)" % [ opts['name'] || 'unnamed', cmd.join(' ') ]

    puts " * #{run}" if run.length > 0
  end

  Dockit::Container.new(opts).start(
    run, verbose: options[:verbose], transient: options[:transient])
end