mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-10-10 23:48:04 +08:00
Merge pull request #1990 from nextcloud/fix/1984/fix-docker-networks
connect containers only to custom network
This commit is contained in:
commit
355175cc36
1 changed files with 5 additions and 4 deletions
|
@ -372,6 +372,7 @@ class DockerActionManager
|
||||||
$portWithProtocol = $value->port . '/' . $value->protocol;
|
$portWithProtocol = $value->port . '/' . $value->protocol;
|
||||||
$exposedPorts[$portWithProtocol] = null;
|
$exposedPorts[$portWithProtocol] = null;
|
||||||
}
|
}
|
||||||
|
$requestBody['HostConfig']['NetworkMode'] = 'nextcloud-aio';
|
||||||
} else {
|
} else {
|
||||||
$requestBody['HostConfig']['NetworkMode'] = 'host';
|
$requestBody['HostConfig']['NetworkMode'] = 'host';
|
||||||
}
|
}
|
||||||
|
@ -622,11 +623,11 @@ class DockerActionManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DisconnectContainerFromNetwork(Container $container) : void
|
private function DisconnectContainerFromBridgeNetwork(string $id) : void
|
||||||
{
|
{
|
||||||
|
|
||||||
$url = $this->BuildApiUrl(
|
$url = $this->BuildApiUrl(
|
||||||
sprintf('networks/%s/disconnect', 'nextcloud-aio')
|
sprintf('networks/%s/disconnect', 'bridge')
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -635,12 +636,11 @@ class DockerActionManager
|
||||||
$url,
|
$url,
|
||||||
[
|
[
|
||||||
'json' => [
|
'json' => [
|
||||||
'container' => $container->GetIdentifier(),
|
'container' => $id,
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} catch (RequestException $e) {
|
} catch (RequestException $e) {
|
||||||
error_log('Could not disconnect container from network ' . $e->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,6 +699,7 @@ class DockerActionManager
|
||||||
public function ConnectMasterContainerToNetwork() : void
|
public function ConnectMasterContainerToNetwork() : void
|
||||||
{
|
{
|
||||||
$this->ConnectContainerIdToNetwork('nextcloud-aio-mastercontainer', '');
|
$this->ConnectContainerIdToNetwork('nextcloud-aio-mastercontainer', '');
|
||||||
|
$this->DisconnectContainerFromBridgeNetwork('nextcloud-aio-mastercontainer');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ConnectContainerToNetwork(Container $container) : void
|
public function ConnectContainerToNetwork(Container $container) : void
|
||||||
|
|
Loading…
Add table
Reference in a new issue