ualex73 / monitor_docker

Monitor Docker containers from Home Assistant
Apache License 2.0
267 stars 34 forks source link

Can't get integration installed #119

Closed erkr closed 2 months ago

erkr commented 1 year ago

Some help needed. I'm running a standard Hass OS setup on a raspberry.

I checked via the web terminal, that there is a folder var/run/docker.sock: image

But I still get this error

This error originated from a custom integration.

Logger: custom_components.monitor_docker.helpers
Source: custom_components/monitor_docker/helpers.py:162 
Integration: Monitor Docker (documentation, issues) 
First occurred: 16:40:22 (1 occurrences) 
Last logged: 16:40:22

[Docker]: Can not connect to Docker API (Missing valid docker_host.Either DOCKER_HOST or local sockets are not available.)
Traceback (most recent call last):
  File "/config/custom_components/monitor_docker/helpers.py", line 162, in __init__
    self._api = aiodocker.Docker(url=url)
  File "/usr/local/lib/python3.10/site-packages/aiodocker/docker.py", line 99, in __init__
    raise ValueError(
ValueError: Missing valid docker_host.Either DOCKER_HOST or local sockets are not available.

Not sure if there is more to do as the FAQ mentions a 'mount' of var/run/docker.sock?!

This is my configuration.yaml:

monitor_docker:
  - name: Docker
    containers:
      - homeassistant
    rename:
      homeassistant: Home Assistant
    monitored_conditions:
      - version
      - containers_running
      - containers_total
      - state
      - status
      - memory

I tried both Hass and homeassistant as container name

Some help would be appreciated as I don't understand how and where to apply that mount command as mentioned in the Readme.

Eric

JGNi commented 9 months ago

I've got exactly the same question. But not much action going in here! Did you ever solve it?

erkr commented 9 months ago

Nope

jopijuco commented 8 months ago

I was having the same issue, to overcome this I added:

volumes:
   - /var/run/docker.sock:/var/run/docker.sock   

as the first of my volumes on my home-assistant container and it worked. I hope it helps.

erkr commented 7 months ago

@jopijuco Thanks for your instructions, as it was that long ago, I found other ways to solve my need to monitor file sizes in containers. I'm using command line sensors with ssh to get them Best Eric