ualex73 / monitor_docker

Monitor Docker containers from Home Assistant
Apache License 2.0
286 stars 35 forks source link

Cannot connect to Docker Engine since v1.19 #153

Open kcofoni opened 2 months ago

kcofoni commented 2 months ago

Hello,

After upgrading to v1.19 (running HA 2027.7.1), I cannot connect any more to my docker engine. I got the following error when starting home assistant in the log file:

2024-07-06 01:48:02.797 ERROR (MainThread) [custom_components.monitor_docker] Failed Docker connect: DockerError(900, "Cannot connect to Docker Engine via tcp://<my_ip>:2376 [Cannot connect to host <my_ip>:2376 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unsuitable certificate purpose (_ssl.c:1000)')]]")

Here is the docker configuration in my configuration.yaml file:

monitor_docker:
  - name: Docker Prod
    url: tcp://<my_ip>:2376
    certpath: /config/docker_certs
    monitored_conditions:
      - allinone
being replaced by a real lan ip address My certificate files have been properly generated for a while. It was perfectly working with the previous version (in particular v1.8). Coming back to v1.18 makes it work again.
ualex73 commented 2 months ago

Can you modify the "custom_components/monitor_docker/manifest.json" to the line: "requirements": ["aiodocker==0.21.0", "python-dateutil==2.8.2"]

Basically downgrading the aiodocker version. Check if after restart the problem persists. Also, are you using the following environment variables: environment:

kcofoni commented 2 months ago

Thanks for the quick answer. It is actually fixing the issue. What is the lasting solution ? I do not use the variables you are referring to.

ualex73 commented 2 months ago

Ok, the problem is in the underlying library. I will try to do a diff on it.

But ... I need to dig in my memory, it is possible the only way TLS is supported with aiodocker is to use certificates (through environment variables). That it worked before, is possible just luck.