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

Method scale

docker/models/services.py:116–133  ·  view source on GitHub ↗

Scale service container. Args: replicas (int): The number of containers that should be running. Returns: bool: ``True`` if successful.

(self, replicas)

Source from the content-addressed store, hash-verified

114 return self.client.api.service_logs(self.id, is_tty=is_tty, **kwargs)
115
116 def scale(self, replicas):
117 """
118 Scale service container.
119
120 Args:
121 replicas (int): The number of containers that should be running.
122
123 Returns:
124 bool: ``True`` if successful.
125 """
126
127 if 'Global' in self.attrs['Spec']['Mode'].keys():
128 raise InvalidArgument('Cannot scale a global container')
129
130 service_mode = ServiceMode('replicated', replicas)
131 return self.client.api.update_service(self.id, self.version,
132 mode=service_mode,
133 fetch_current_spec=True)
134
135 def force_update(self):
136 """

Calls 3

InvalidArgumentClass · 0.90
ServiceModeClass · 0.90
update_serviceMethod · 0.80

Tested by 2