allow to specify an apache ip-binding

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-07-08 17:11:49 +02:00
parent 005ad34741
commit 482b279f3c
4 changed files with 30 additions and 6 deletions

View file

@ -314,13 +314,22 @@ class DockerActionManager
if(count($exposedPorts) > 0) {
$requestBody['ExposedPorts'] = $exposedPorts;
foreach($container->GetPorts()->GetPorts() as $port) {
foreach ($container->GetPorts()->GetPorts() as $port) {
$portNumber = explode("/", $port);
$requestBody['HostConfig']['PortBindings'][$port] = [
[
'HostPort' => $portNumber[0],
]
];
if ($this->configurationManager->GetApachePort() === $portNumber[0] && $this->configurationManager->GetApacheIPBinding() !== '') {
$requestBody['HostConfig']['PortBindings'][$port] = [
[
'HostPort' => $portNumber[0],
'HostIp' => $this->configurationManager->GetApacheIPBinding(),
]
];
} else {
$requestBody['HostConfig']['PortBindings'][$port] = [
[
'HostPort' => $portNumber[0],
]
];
}
}
}