oboki commented on code in PR #38466: URL: https://github.com/apache/airflow/pull/38466#discussion_r1544832963
########## airflow/providers/docker/hooks/docker.py: ########## @@ -146,15 +151,23 @@ def construct_tls_config( @cached_property def api_client(self) -> APIClient: """Create connection to docker host and return ``docker.APIClient`` (cached).""" - client = APIClient( - base_url=self.__base_url, version=self.__version, tls=self.__tls, timeout=self.__timeout - ) - if self.docker_conn_id: - # Obtain connection and try to login to Container Registry only if ``docker_conn_id`` set. - self.__login(client, self.get_connection(self.docker_conn_id)) - - self._client_created = True - return client + for url in self.__base_url: + try: + client = APIClient( + base_url=url, version=self.__version, tls=self.__tls, timeout=self.__timeout + ) + if not client.ping(): + raise ConnectionError("Failed to ping host %s.", url) Review Comment: @Taragolis I've added a test code `test_connect_to_valid_host` to check which of the given URLs is valid and connect to it, and I've updated the docstring related to this improvement. -- 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