From 82458a44cb19d4e19554a33b44dfc4ef679eaf46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Dugat?= Date: Tue, 29 May 2018 12:04:00 +0000 Subject: [PATCH] Fixes --- .../DockerContainer/ElasticsearchDockerContainer.php | 2 ++ .../DockerContainer/NginxDockerContainer.php | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Application/DockerContainer/ElasticsearchDockerContainer.php b/src/Application/DockerContainer/ElasticsearchDockerContainer.php index 4b49c6b..f2c05ec 100644 --- a/src/Application/DockerContainer/ElasticsearchDockerContainer.php +++ b/src/Application/DockerContainer/ElasticsearchDockerContainer.php @@ -26,6 +26,8 @@ public function getPackageManager(): string */ public function preExecute(): void { + parent::preExecute(); + $service = $this->getService(); if (true === $service->getOptions()['with_management']) { $service diff --git a/src/Application/DockerContainer/NginxDockerContainer.php b/src/Application/DockerContainer/NginxDockerContainer.php index 006a9a1..1e7d18d 100644 --- a/src/Application/DockerContainer/NginxDockerContainer.php +++ b/src/Application/DockerContainer/NginxDockerContainer.php @@ -91,9 +91,16 @@ public function postExecute(): void } // Main Network Aliases. - $this->addNetworkAlias(self::DOCKER_MAIN_NETWORK, $service->getHost()); + $isServiceNetworkAliasable = function (ServiceInterface $service) { + return null !== $service->getHost(); + }; + if (true === $isServiceNetworkAliasable($service)) { + $this->addNetworkAlias(self::DOCKER_MAIN_NETWORK, $service->getHost()); + } foreach ($this->vhostsServicesByHost as $vhostService) { - $this->addNetworkAlias(self::DOCKER_MAIN_NETWORK, $vhostService->getHost()); + if ($isServiceNetworkAliasable($vhostService)) { + $this->addNetworkAlias(self::DOCKER_MAIN_NETWORK, $vhostService->getHost()); + } } }