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()); + } } }