diff --git a/src/app/CliTools/Console/Command/Sync/AbstractCommand.php b/src/app/CliTools/Console/Command/Sync/AbstractCommand.php index de416c5..6cbf250 100644 --- a/src/app/CliTools/Console/Command/Sync/AbstractCommand.php +++ b/src/app/CliTools/Console/Command/Sync/AbstractCommand.php @@ -608,15 +608,23 @@ protected function checkIfDockerExists() $dockerPath = \CliTools\Utility\DockerUtility::searchDockerDirectoryRecursive(); if (!empty($dockerPath)) { - $this->output->writeln('Running docker containers:'); + $this->output->writeln('Found docker-compose.yml'); - // Docker instance found - $docker = new CommandBuilder('docker', 'ps'); - $docker->executeInteractive(); + try { + $this->output->writeln('Trying to detect running docker containers ...'); + + $docker = new CommandBuilder('docker', 'ps'); + $docker->executeInteractive(); - $answer = ConsoleUtility::questionYesNo('Are these running containers the right ones?', 'no'); + $answer = ConsoleUtility::questionYesNo('Are these running containers the right ones?', 'no'); + } catch (\CliTools\Exception\CommandExecutionException $e) { + $this->output->writeln('' . $e->getMessage() . ''); + + $answer = ConsoleUtility::questionYesNo('Continue anyway?', 'no'); + } - if (!$answer) { + if (empty($answer)) { + $this->output->writeln('Aborting'); throw new \CliTools\Exception\StopException(1); } }