[Autoscaler] Actually try to catch when docker does not exist (#10549)

This commit is contained in:
Ian Rodney 2020-09-03 14:00:06 -07:00 committed by GitHub
parent 89bf262130
commit c54853d45b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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",