Exposing docker.sock for monitor_docker

Again thank you for the idea and yes it work on my end and adding the rest of proxy-server on all my other docker solve my multilink. This docker-proxy-server does not require certificate, so it will work everytime I update my home-assistant. YAY!

Thanks for coming back to me. I haven’t done anything re proxies or certs… I guess I need to find a tutorial. I assumed it would be as easy as adding in the IP:port and then logging in.

I will be making documentation for it so stay tuned. Actually a better proxy without having to have error messages pop-up

@Redpizza @Craig_McGowan I find a better solution and fork the project just, so I can make docker hub available for you guys who used RPI and RPI64. I still haven’t been able to write a how-to guide, but you can see the README document on the project.

Docker users should easily know how to do it.

P.S. This method will remove all the errors and need for scan_interval being implemented. Also work for multiple docker server.

Special credit for Sami Jawhar

Unfortunately, as stated in my first message, I’m not too au fait with Docker so I’ll await your how to guide :slight_smile:

Alright, I finally have time to do some write-up. Nothing fancy, but I hope it will help anyone who would like to run Monitor Docker on HA Supervised version.

https://krdesigns.com/articles/Installing-MonitorDocker-on-HA-Supervised-the-rightway

Whilst id love to get this working as I have just this morning uninstalled the original proxy suggestion method by redpizza due to errors appearing in my logs regularly, im totally lost at step 4 of your instructions where creating TLS.

I have follwed the instructions on docker so far as generating ca-key.pem, cert.pem, key.pem, server-key.pem, ca.pem and server-cert.pem.

However, im baffled now.

Im running Home Assistant Supervised in Docker and the only containers I want to monitor are in the same docker instance. Im confused by what certs are meant to be copied where etc

the certificate is needed to run the docker-socket-proxy for example you will put the certs in /usr/share/hassio/docker/certs for example then make sure you will have all the certificate in there. Then you can run

docker run --name docker-socket-proxy --restart always -d -p 2376:2376 -v /var/run/docker.sock:/var/run/docker.sock -v /usr/share/hassio/docker/certs:/run/secrets ranrinc/docker-socket-proxy

Next you copy 3 files follow my documentation into your homeassistant/.certs folder which known as /config/.certs directory. Be sure that you add .certs directory, so HA able to read the certs and call the functions. Thats it.

Thank you for the additional help.

I seem to have it working now and it seems to work better than the original solution I accepted by @redpizza in so much as I can stop and start containers and everything remains consistent.

Ill see how it goes before updating the solution again, but fingers crossed!! Thank you so much for the guide

I guess youve had it running for a few days anyway, have you noticed any errors being thrown out?

I actually already using this method for almost a couple of months without realizing that I can implement it on the local docker too… And this method is 100% free from error

Hi
How to show all theese sensors
I have only running containers and docker version
I have pasted the code shown on github on config.yaml
Some other way to enable the sensors ?

What is your code in configuration.yaml? Have you set any monitored_conditions?

Thank you for the answer
I’m trying adjusting the code…

Getting this error message

Can not connect to Docker API ([Errno 2] No such file or directory)
Traceback (most recent call last):
  File "/config/custom_components/monitor_docker/helpers.py", line 141, in __init__
    self._api = aiodocker.Docker(url=url)
  File "/usr/local/lib/python3.9/site-packages/aiodocker/docker.py", line 108, in __init__
    ssl_context = self._docker_machine_ssl_context()
  File "/usr/local/lib/python3.9/site-packages/aiodocker/docker.py", line 367, in _docker_machine_ssl_context
    context.load_cert_chain(
FileNotFoundError: [Errno 2] No such file or directory

What have I done wrong? Is it the config/certs or the usr/share/hassio/docker/certs where it cant find the certs?

Used this solution and it works fine

cannot for the life of me get this to work properly! tried the docker proxy method, which is the closest i got - it discovers the containers and populates them into HA, but then none of the sensor data or switches seem to actually work.

I attempted your solution from the guide you linked but this didn’t work at all :frowning:

Would super appreciate some help if anyone is willing :pray:

I post the guide that I wrote maybe you should read and try it. Please let me know which part fails?

hi! thanks for the offer of assistance :slight_smile:

I followed your guide which is very helpful, but i can’t seem to get it to work.

I believe i created all the certificates correctly and copied the three required into the /config/.certs/ folder (which i had to create myself) on my HA machine.

Then installed Monitor Docker and added the following to my config.yaml:

monitor_docker:
  - name: Docker
    url: tcp://192.168.1.180:2376
    certpath: '/config/.certs'

But when i restart HA, nothing is populated.

For reference, i have my containers running on a separate RPi to my HA server.

be sure proxy-server needs to be installed on your remote docker. Else it won’t work

yes, docker-socket is running on the RPi with the container on it:

what i’m wondering is if this command needs to be run on the HA machine or the one with the containers:

docker run --name docker-socket-proxy --restart always -d -p 2376:2376 -v /var/run/docker.sock:/var/run/docker.sock -v /usr/share/hassio/docker/certs:/run/secrets ranrinc/docker-socket-proxy