Nodes¶
Get and list nodes in a swarm. Before you can use these methods, you first need to join or initialize a swarm.
Methods available on client.nodes:
Node objects¶
-
class
Node¶ A node in a swarm.
-
id¶ The ID of the object.
-
short_id¶ The ID of the object, truncated to 10 characters.
-
attrs¶ The raw representation of this object from the server.
-
version¶ The version number of the service. If this is not the same as the server, the
update()function will not work and you will need to callreload()before calling it again.
-
reload()¶ Load this object from the server again and update
attrswith the new data.
-
update(node_spec)¶ Update the node’s configuration.
Parameters: node_spec (dict) – Configuration settings to update. Any values not provided will be removed. Default: NoneReturns: True if the request went through. Raises: docker.errors.APIError– If the server returns an error.Example
>>> node_spec = {'Availability': 'active', 'Name': 'node-name', 'Role': 'manager', 'Labels': {'foo': 'bar'} } >>> node.update(node_spec)
-