A service.
Method | force |
Force update the service even if no changes require it. |
Method | logs |
Get log stream for the service. Note: This method works only for services with the ``json-file`` or ``journald`` logging drivers. |
Method | remove |
Stop and remove the service. |
Method | scale |
Scale service container. |
Method | tasks |
List the tasks in this service. |
Method | update |
Update a service's configuration. Similar to the ``docker service update`` command. |
Class Variable | id |
Undocumented |
Property | name |
The service's name. |
Property | version |
The version number of the service. If this is not the same as the server, the :py:meth:`update` function will not work and you will need to call :py:meth:`reload` before calling it again. |
Inherited from Model
:
Method | __eq__ |
Undocumented |
Method | __hash__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | reload |
Load this object from the server again and update ``attrs`` with the new data. |
Instance Variable | attrs |
Undocumented |
Instance Variable | client |
Undocumented |
Instance Variable | collection |
Undocumented |
Property | id |
The ID of the object. |
Property | short |
The ID of the object, truncated to 12 characters. |
Get log stream for the service. Note: This method works only for services with the ``json-file`` or ``journald`` logging drivers. Args: details (bool): Show extra details provided to logs. Default: ``False`` follow (bool): Keep connection open to read logs as they are sent by the Engine. Default: ``False`` stdout (bool): Return logs from ``stdout``. Default: ``False`` stderr (bool): Return logs from ``stderr``. Default: ``False`` since (int): UNIX timestamp for the logs staring point. Default: 0 timestamps (bool): Add timestamps to every log line. tail (string or int): Number of log lines to be returned, counting from the current end of the logs. Specify an integer or ``'all'`` to output all log lines. Default: ``all`` Returns: generator: Logs for the service.
Stop and remove the service. Raises: :py:class:`docker.errors.APIError` If the server returns an error.
Scale service container. Args: replicas (int): The number of containers that should be running. Returns: bool: ``True`` if successful.
List the tasks in this service. Args: filters (dict): A map of filters to process on the tasks list. Valid filters: ``id``, ``name``, ``node``, ``label``, and ``desired-state``. Returns: :py:class:`list`: List of task dictionaries. Raises: :py:class:`docker.errors.APIError` If the server returns an error.