Method: Docker::Exec.create

Defined in:
lib/docker/exec.rb

.create(options = {}, conn = Docker.connection) ⇒ Docker::Exec

Create a new Exec instance in a running container. Please note, this does NOT execute the instance - you must run #start. Also, each instance is one-time use only.

Parameters:

  • options (Hash) (defaults to: {})

    Parameters to pass in to the API.

  • conn (Docker::Connection) (defaults to: Docker.connection)

    Connection to Docker Remote API

Returns:



20
21
22
23
24
25
26
# File 'lib/docker/exec.rb', line 20

def self.create(options = {}, conn = Docker.connection)
  container = options.delete('Container')
  resp = conn.post("/containers/#{container}/exec", {},
    :body => options.to_json)
  hash = Docker::Util.parse_json(resp) || {}
  new(conn, hash)
end