class Docker::API::Exec
This class represents the Docker
API exec related endpoints. @see docs.docker.com/engine/api/v1.40/#tag/Exec
Public Instance Methods
Run a command inside a running container.
Docker
API: POST /containers/{id}/exec @see docs.docker.com/engine/api/v1.40/#operation/ContainerExec
@param name [String]: The ID or name of the container. @param body [Hash]: Request body to be sent as json.
# File lib/docker/api/exec.rb, line 14 def create name, body = {} @connection.request(method: :post, path: "/containers/#{name}/exec", headers: {"Content-Type": "application/json"}, body: body.to_json ) end
Return low-level information about an exec instance.
Docker
API: GET /exec/{id}/json @see docs.docker.com/engine/api/v1.40/#operation/ExecInspect
@param name [String]: Exec
instance ID.
# File lib/docker/api/exec.rb, line 51 def details name @connection.get("/exec/#{name}/json") end
Resize the TTY session used by an exec instance.
Docker
API: POST /exec/{id}/resize @see docs.docker.com/engine/api/v1.40/#operation/ExecResize
@param name [String]: Exec
instance ID. @param body [Hash]: Request body to be sent as json.
# File lib/docker/api/exec.rb, line 40 def resize name, params = {} @connection.post(build_path("/exec/#{name}/resize", params)) end
Start a previously set up exec instance.
Docker
API: POST /exec/{id}/start @see docs.docker.com/engine/api/v1.40/#operation/ExecStart
@param name [String]: Exec
instance ID. @param body [Hash]: Request body to be sent as json. @param &block: Replace the default output to stdout behavior.
# File lib/docker/api/exec.rb, line 27 def start name, body = {}, &block @connection.request(method: :post, path: "/exec/#{name}/start", headers: {"Content-Type": "application/json"}, body: body.to_json, response_block: block_given? ? block : default_streamer ) end