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 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 @connection.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 = {} @connection.get(build_path("/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 = 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 |