Class: Docker::API::Task
Overview
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.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#details(name) ⇒ Object
Inspect a task.
-
#list(params = {}) ⇒ Object
List tasks.
-
#logs(name, params = {}, &block) ⇒ Object
Get stdout and stderr logs from a task.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Docker::API::Base
Instance Method Details
#details(name) ⇒ Object
Inspect a task
Docker API: GET /tasks/id
23 24 25 |
# File 'lib/docker/api/task.rb', line 23 def details name get("/tasks/#{name}") end |
#list(params = {}) ⇒ Object
List tasks
Docker API: GET /tasks
13 14 15 |
# File 'lib/docker/api/task.rb', line 13 def list params = {} get("/tasks",params) end |
#logs(name, params = {}, &block) ⇒ Object
Get stdout and stderr logs from a task.
Docker API: GET /tasks/id/logs
35 36 37 38 39 40 41 42 43 |
# File 'lib/docker/api/task.rb', line 35 def logs name, params = {}, &block path = "/tasks/#{name}/logs" if [true, 1 ].include? params[:follow] request(method: :get, path: path , params: params, response_block: block_given? ? block : default_streamer) else get(path, params) end end |