Taragolis commented on code in PR #38466:
URL: https://github.com/apache/airflow/pull/38466#discussion_r1543759158


##########
airflow/providers/docker/operators/docker.py:
##########
@@ -343,13 +345,20 @@ def hook(self) -> DockerHook:
             assert_hostname=self.tls_hostname,
             ssl_version=self.tls_ssl_version,
         )
-        return DockerHook(
-            docker_conn_id=self.docker_conn_id,
-            base_url=self.docker_url,
-            version=self.api_version,
-            tls=tls_config,
-            timeout=self.timeout,
-        )
+        for url in self.docker_url:
+            hook = DockerHook(
+                docker_conn_id=self.docker_conn_id,
+                base_url=url,
+                version=self.api_version,
+                tls=tls_config,
+                timeout=self.timeout,
+            )
+            try:
+                hook.get_conn()
+                return hook
+            except Exception as e:
+                self.log.error("Failed to establish connection to Docker host 
%s: %s", url, e)
+        raise Exception("Failed to establish connection to Docker host.")

Review Comment:
   Maybe AirflowException or python's builtin, if we could better avoid third 
party exceptions 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to