class Docker::API::Task
This class represents the Docker
API endpoints regarding tasks.
A task is a container running on a swarm. It is the atomic scheduling unit of swarm. Swarm mode must be enabled for these endpoints to work. @see docs.docker.com/engine/api/v1.40/#tag/Task
Public Instance Methods
Inspect a task
Docker
API: GET /tasks/{id} @see docs.docker.com/engine/api/v1.40/#operation/TaskInspect
@param name [String]: The ID or name of the task.
# File lib/docker/api/task.rb, line 23 def details name @connection.get("/tasks/#{name}") end
List tasks
Docker
API: GET /tasks @see docs.docker.com/engine/api/v1.40/#operation/TaskList
@param params [Hash]: Parameters that are appended to the URL.
# File lib/docker/api/task.rb, line 13 def list params = {} @connection.get(build_path("/tasks",params)) end
Get stdout and stderr logs from a task.
Docker
API: GET /tasks/{id}/logs @see docs.docker.com/engine/api/v1.40/#operation/TaskLogs
@param name (String) : The ID or name of the task. @param params (Hash) : Parameters that are appended to the URL. @param &block: Replace the default output to stdout behavior.
# File lib/docker/api/task.rb, line 35 def logs name, params = {}, &block path = build_path("/tasks/#{name}/logs", params) if [true, 1 ].include? params[:follow] @connection.request(method: :get, path: path , response_block: block_given? ? block : default_streamer) else @connection.get(path) end end