fix exposing containers

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-01-02 17:37:57 +01:00
parent eaabc8e4b0
commit cb980f9e84
3 changed files with 17 additions and 18 deletions

View file

@ -361,31 +361,19 @@ class DockerActionManager
$exposedPorts = [];
if ($container->GetInternalPort() !== 'host') {
foreach($container->GetPorts()->GetPorts() as $value) {
$exposedPorts[$value->port] = null;
$portWithProtocol = $value->port . '/' . $value->protocol;
$exposedPorts[$portWithProtocol] = null;
}
}
if(count($exposedPorts) > 0) {
$requestBody['ExposedPorts'] = $exposedPorts;
foreach ($container->GetPorts()->GetPorts() as $value) {
$port = $value->port;
if($port === '%APACHE_PORT%') {
$port = $this->configurationManager->GetApachePort();
} elseif($port === '%TALK_PORT%') {
$port = $this->configurationManager->GetTalkPort();
}
$ipBinding = $value->ipBinding;
if($ipBinding === '%APACHE_IP_BINDING%') {
$ipBinding = $this->configurationManager->GetApacheIPBinding();
}
if ($ipBinding === '') {
$ipBinding = '0.0.0.0';
}
$protocol = $value->protocol;
$portWithProtocol = $port . '/' . $protocol;
$requestBody['ExposedPorts'][$portWithProtocol] = null;
$requestBody['HostConfig']['PortBindings'][$port] = [
$requestBody['HostConfig']['PortBindings'][$portWithProtocol] = [
[
'HostPort' => $port,
'HostIp' => $ipBinding,