Has anyone got any experience of getting Monitor Docker working once added via HACS?
I have followed the instructions, added docker.sock added as a volume in the docker compose file. I have tried enabling the docker API for remote connections and specifying the IP in the config file but no matter what I do the logs show that the integration cant connect to the docker API.
Any suggestions on where to start?
HA core 2022.10.2 running in docker on ubuntu
Docker version 20.10.12
Docker-compose version 1.25.0
Error message: [Docker]: Can not connect to Docker API (Missing valid docker_host.Either DOCKER_HOST or local sockets are not available.)
name: Docker
#url: unix:///var/run/docker.sock #Tested to see if it would work - No
#url: tcp://192.168.1.31:2376 #Tested to see if would work - No
containers:
- homeassistant
- pihole
- nut
- unifi
monitored_conditions:
- version
- containers_running
- containers_total
- state
- status
- memory
- uptime
- memory_percentage
As a test, I tried adding ti all directly to the configuration.yaml file and get the same result. monitor_docker is running but cant connect to the docker instance its running in.
Connecting to the docker API via curl works from the host running docker so that side seems to be ok
I already have debug enabled and getting this error in the log
2022-10-31 12:48:59.383 DEBUG (Thread-2 (RunDocker)) [custom_components.monitor_docker.helpers] [Docker]: Helper version: 1.14
2022-10-31 12:48:59.386 ERROR (Thread-2 (RunDocker)) [custom_components.monitor_docker.helpers] [Docker]: Can not connect to Docker API (Missing valid docker_host.Either DOCKER_HOST or local sockets are not available.)
File "/config/custom_components/monitor_docker/helpers.py", line 162, in __init__
Its all very strange
No matter how I try to get it to connect, socket or via api on port 2376, it just doesnt want to connect so I am guessing its a container or docker config issue but can’t for the life of me find anything that looks wrong
did you do this part?
I didn’t check my logs before I did that.
Raspberry Pi (Raspbian)
Using a Raspberry Pi with Raspbian it could happen no memory is reported. In such case the Docker API does not report it to Monitor Docker. Making the following changes, normally fixes the problem:
Open the file /boot/cmdline.txt
Add the following to the end of the existing line cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
Reboot your Raspberry Pi
NOTE: Add the line to the existing line, do not replace it
Ubuntu / Debian
Also on Ubuntu/Debian it is possible no memory is shown, the following changes could solve your problem:
Open the file /etc/default/grub
Modify the GRUB_CMDLINE_LINUX_DEFAULT="" to GRUB_CMDLINE_LINUX_DEFAULT="quiet cgroup_enable=memory swapaccount=1"
Run sudo update-grub
Reboot your Ubuntu/Debian
NOTE: This is untested, use at your risk