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

Method join_swarm

docker/api/swarm.py:217–265  ·  view source on GitHub ↗

Make this Engine join a swarm that has already been created. Args: remote_addrs (:py:class:`list`): Addresses of one or more manager nodes already participating in the Swarm to join. join_token (string): Secret token for joining this Swarm.

(self, remote_addrs, join_token, listen_addr='0.0.0.0:2377',
                   advertise_addr=None, data_path_addr=None)

Source from the content-addressed store, hash-verified

215
216 @utils.minimum_version('1.24')
217 def join_swarm(self, remote_addrs, join_token, listen_addr='0.0.0.0:2377',
218 advertise_addr=None, data_path_addr=None):
219 """
220 Make this Engine join a swarm that has already been created.
221
222 Args:
223 remote_addrs (:py:class:`list`): Addresses of one or more manager
224 nodes already participating in the Swarm to join.
225 join_token (string): Secret token for joining this Swarm.
226 listen_addr (string): Listen address used for inter-manager
227 communication if the node gets promoted to manager, as well as
228 determining the networking interface used for the VXLAN Tunnel
229 Endpoint (VTEP). Default: ``'0.0.0.0:2377``
230 advertise_addr (string): Externally reachable address advertised
231 to other nodes. This can either be an address/port combination
232 in the form ``192.168.1.1:4567``, or an interface followed by a
233 port number, like ``eth0:4567``. If the port number is omitted,
234 the port number from the listen address is used. If
235 AdvertiseAddr is not specified, it will be automatically
236 detected when possible. Default: ``None``
237 data_path_addr (string): Address or interface to use for data path
238 traffic. For example, 192.168.1.1, or an interface, like eth0.
239
240 Returns:
241 ``True`` if the request went through.
242
243 Raises:
244 :py:class:`docker.errors.APIError`
245 If the server returns an error.
246 """
247 data = {
248 'RemoteAddrs': remote_addrs,
249 'ListenAddr': listen_addr,
250 'JoinToken': join_token,
251 'AdvertiseAddr': advertise_addr,
252 }
253
254 if data_path_addr is not None:
255 if utils.version_lt(self._version, '1.30'):
256 raise errors.InvalidVersion(
257 'Data address path is only available for '
258 'API version >= 1.30'
259 )
260 data['DataPathAddr'] = data_path_addr
261
262 url = self._url('/swarm/join')
263 response = self._post_json(url, data=data)
264 self._raise_for_status(response)
265 return True
266
267 @utils.minimum_version('1.24')
268 def leave_swarm(self, force=False):

Callers 3

test_join_swarmMethod · 0.80
joinMethod · 0.80

Calls 3

_urlMethod · 0.80
_post_jsonMethod · 0.80
_raise_for_statusMethod · 0.80