MCPcopy Index your code
hub / github.com/docker/docker-py / update

Method update

docker/models/services.py:58–85  ·  view source on GitHub ↗

Update a service's configuration. Similar to the ``docker service update`` command. Takes the same parameters as :py:meth:`~ServiceCollection.create`. Raises: :py:class:`docker.errors.APIError` If the server returns an error.

(self, **kwargs)

Source from the content-addressed store, hash-verified

56 return self.client.api.tasks(filters=filters)
57
58 def update(self, **kwargs):
59 """
60 Update a service's configuration. Similar to the ``docker service
61 update`` command.
62
63 Takes the same parameters as :py:meth:`~ServiceCollection.create`.
64
65 Raises:
66 :py:class:`docker.errors.APIError`
67 If the server returns an error.
68 """
69 # Image is required, so if it hasn't been set, use current image
70 if 'image' not in kwargs:
71 spec = self.attrs['Spec']['TaskTemplate']['ContainerSpec']
72 kwargs['image'] = spec['Image']
73
74 if kwargs.get('force_update') is True:
75 task_template = self.attrs['Spec']['TaskTemplate']
76 current_value = int(task_template.get('ForceUpdate', 0))
77 kwargs['force_update'] = current_value + 1
78
79 create_kwargs = _get_create_service_kwargs('update', kwargs)
80
81 return self.client.api.update_service(
82 self.id,
83 self.version,
84 **create_kwargs
85 )
86
87 def logs(self, **kwargs):
88 """

Callers 1

force_updateMethod · 0.95

Calls 3

update_serviceMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected