Method: Docker::Exec#start!
- Defined in:
- lib/docker/exec.rb
#start!(options = {}, &block) ⇒ Array, Int
Start the Exec instance. The Exec instance is deleted after this so this command can only be run once.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/docker/exec.rb', line 52 def start!( = {}, &block) # Parse the Options tty = !!.delete(:tty) detached = !!.delete(:detach) stdin = [:stdin] read_timeout = [:wait] # Create API Request Body body = MultiJson.dump( 'Tty' => tty, 'Detach' => detached ) excon_params = { body: body } msgs = Docker::Messages.new unless detached if stdin excon_params[:hijack_block] = Docker::Util.hijack_for(stdin, block, msgs, tty) else excon_params[:response_block] = Docker::Util.attach_for(block, msgs, tty) end end excon_params[:read_timeout] = read_timeout unless read_timeout.nil? connection.post(path_for(:start), nil, excon_params) [msgs., msgs., self.json['ExitCode']] end |