From c54853d45b9d5084a3f91d492887e2e859ee995a Mon Sep 17 00:00:00 2001 From: Ian Rodney Date: Thu, 3 Sep 2020 14:00:06 -0700 Subject: [PATCH] [Autoscaler] Actually try to catch when docker does not exist (#10549) --- python/ray/autoscaler/command_runner.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/ray/autoscaler/command_runner.py b/python/ray/autoscaler/command_runner.py index cd38f09e7..2a15d528d 100644 --- a/python/ray/autoscaler/command_runner.py +++ b/python/ray/autoscaler/command_runner.py @@ -659,10 +659,11 @@ class DockerCommandRunner(CommandRunnerInterface): self.container_name) def _check_docker_installed(self): - try: - self.ssh_command_runner.run("command -v docker") - return - except Exception: + no_exist = "NoExist" + output = self.ssh_command_runner.run( + f"command -v docker || echo '{no_exist}'", with_output=True) + cleaned_output = output.decode().strip() + if no_exist in cleaned_output or "docker" not in cleaned_output: install_commands = [ "curl -fsSL https://get.docker.com -o get-docker.sh", "sudo sh get-docker.sh", "sudo usermod -aG docker $USER",