Class: DockerEngineAPI::Resources::Exec

Inherits:
Object
  • Object
show all
Defined in:
lib/docker_engine_api/resources/exec.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Exec

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Exec.

Parameters:



86
87
88
# File 'lib/docker_engine_api/resources/exec.rb', line 86

def initialize(client:)
  @client = client
end

Instance Method Details

#inspect_(id, request_options: {}) ⇒ DockerEngineAPI::Models::ExecInspectResponse

Return low-level information about an exec instance.

Parameters:

Returns:

See Also:



17
18
19
20
21
22
23
24
# File 'lib/docker_engine_api/resources/exec.rb', line 17

def inspect_(id, params = {})
  @client.request(
    method: :get,
    path: ["exec/%1$s/json", id],
    model: DockerEngineAPI::Models::ExecInspectResponse,
    options: params[:request_options]
  )
end

#resize(id, h:, w:, request_options: {}) ⇒ nil

Resize the TTY session used by an exec instance. This endpoint only works if tty was specified as part of creating and starting the exec instance.

Parameters:

  • id (String)

    Exec instance ID

  • h (Integer)

    Height of the TTY session in characters

  • w (Integer)

    Width of the TTY session in characters

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



42
43
44
45
46
47
48
49
50
51
# File 'lib/docker_engine_api/resources/exec.rb', line 42

def resize(id, params)
  parsed, options = DockerEngineAPI::ExecResizeParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["exec/%1$s/resize", id],
    query: parsed,
    model: NilClass,
    options: options
  )
end

#start(id, console_size: nil, detach: nil, tty: nil, request_options: {}) ⇒ nil

Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command. Otherwise, it sets up an interactive session with the command.

Parameters:

  • id (String)

    Exec instance ID

  • console_size (Array<Integer>, nil)

    Initial console size, as an ‘[height, width]` array.

  • detach (Boolean)

    Detach from the command.

  • tty (Boolean)

    Allocate a pseudo-TTY.

  • request_options (DockerEngineAPI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



72
73
74
75
76
77
78
79
80
81
# File 'lib/docker_engine_api/resources/exec.rb', line 72

def start(id, params = {})
  parsed, options = DockerEngineAPI::ExecStartParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["exec/%1$s/start", id],
    body: parsed,
    model: NilClass,
    options: options
  )
end