models.nodes

Module Contents

Classes

Node() A node in a swarm.
NodeCollection() Nodes on the Docker server.
class Node

A node in a swarm.

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 call reload() before calling it again.

update(node_spec)

Update the node’s configuration.

Args:
node_spec (dict): Configuration settings to update. Any values
not provided will be removed. Default: None
Returns:
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)
remove(force=False)

Remove this node from the swarm.

Args:
force (bool): Force remove an active node. Default: False
Returns:
True if the request was successful.
Raises:
docker.errors.NotFound
If the node doesn’t exist in the swarm.
docker.errors.APIError
If the server returns an error.
class NodeCollection

Nodes on the Docker server.

get(node_id)

Get a node.

Args:
node_id (string): ID of the node to be inspected.
Returns:
A Node object.
Raises:
docker.errors.APIError
If the server returns an error.
list(*args, **kwargs)

List swarm nodes.

Args:
filters (dict): Filters to process on the nodes list. Valid
filters: id, name, membership and role. Default: None
Returns:
A list of Node objects.
Raises:
docker.errors.APIError
If the server returns an error.

Example:

>>> client.nodes.list(filters={'role': 'manager'})