connectNetwork method
Connects containerId to networkId.
Optional aliases are DNS names by which containerId will be
reachable by other containers on networkId.
Implementation
Future<void> connectNetwork(
String networkId,
String containerId, {
List<String>? aliases,
}) async {
final body = <String, dynamic>{
'Container': containerId,
if (aliases != null)
'EndpointConfig': {
'Aliases': aliases,
},
};
final resp = await _request(
'POST',
'/networks/$networkId/connect',
body: body,
);
if (resp.statusCode != 200 && resp.statusCode != 204) {
_throwIfError(resp);
}
}