Method: Docker::Session#run!

Defined in:
lib/docker/session.rb

#run!(*args) {|stream, data| ... } ⇒ String

Run a docker command without validating that the CLI parameters make sense. Prepend implicit options if suitable.

Parameters:

  • args (Array)

    command-line arguments in the format accepted by Backticks::Runner#command

Yields:

  • (stream, data)

    intercepts command I/O and passes it to the block

Yield Parameters:

  • stream (Symbol)

    :stdin, :stdout or :stderr

  • data (String)

    the intercepted stream activity

Returns:

  • (String)

    output of the command

Raises:

  • (RuntimeError)

    if command fails



219
220
221
222
223
224
225
226
227
228
# File 'lib/docker/session.rb', line 219

def run!(*args, &block)
  # STDERR.puts "+ " + (['docker'] + args).inspect
  cmd = @shell.run('docker', *args)
  cmd.tap(&block) if block_given?
  cmd.join

  status, out, err = cmd.status, cmd.captured_output, cmd.captured_error
  status.success? || raise(Error.new(args.first, status, err))
  out
end