Using homekit component inside Docker

Hello everybody,

I think this is a very simple question but I can’t figure out how to do it. I tried to use the homekit component but every time I add the homekit setting to the configuration.yaml I get the error that home assistant could not find the component ‘homekit’.

I even tried it with the sample code from here.

Am I missing something?

1 Like

Home Assistant version 0.64 or better?

Ok I see where my error is. Thank you for that.

Currently I’m using version 0.63.3. I will update and try it again.

Ok I updated my setup and even opened the port to the network. The component installation worked. But inside my home app I cannot find the bridge.

Any advice?

I am not using it, I use Homebridge with the Homebridge-Homeassistant add-on. But I had to enter the pin-code manually within iOS Home app, as it was not discovered automatically.

Were you able to get this resolved? As of 0.66.1 I’m unable to use the HomeKit component within Docker.

Does your Docker container run with --net=host? Because Homekit uses mDNS to open random ports in addition the the control port. It’s not working with Docker and dedicated port control.

I am running with --net=host. I restarted the Home Assistant container again today and it appears to be working.

1 Like

Hmmm, it seems like I might be stuck then, as I’m using Docker for Mac and it needs to have --net=bridge for some reason. Everything other than HomeKit seems to be working though, so I might just have to let it go.

Yep, I had the same issue. Docker for Mac has some networking limitations so I ended up with running Virtualbox on my Mac to overcome this issue. Works very well.

I saw that mentioned as a workaround option, but I’m hesitant as I just switched to Docker for Mac to get away from running VMs in VMWare Fusion. What are you using as the VM in VirtualBox, is it https://github.com/boot2docker/boot2docker?

Had the same feeling, moved from a RPI to Mac and thought it was a step back using virtualbox. However I use a Ubuntu 18.04 VM and am pretty happy with it as it uses little resources and is very stable. A more lightweight OS could be interresting though.

I’ve got it up and running now in a Container Linux VM running in VMWare Fusion. The networking works as expected in host mode, including the mDNS for Homekit.

I’m digging the container approach so far, but I wouldn’t recommend Docker for Mac. On top of the network weirdness, it had some kind of memory leak that ate up all of the available RAM on the host.

Thanks for discovering what this problem is/was! I was having the same trouble (with ‘–net=host’ set for the Docker container).

I managed to get around it by running the Home Assistant Docker container through Traefik (reverse proxy), which I was doing anyway with my original/previous container running Home Assistant, to enable SSL and redirect HA to my domain.

did you find a solution for homekit with hass in docker with traefik?

Yes, here’s my config that works for me

Strange, my config is the same but no respons of hass in homekit.

Presumably you added/enabled entities to expose to HomeKit under homekit: in configuration.yaml?

If so, do you see the Home Assistant Bridge in any of the HomeKit apps?

yes I put some entities in homekit, but when I look it up in the iOS app I don’t see the bridge and I can’t connect when I type in the number from hass.

Have you tried disabling/removing traefik and just running Home Assistant via Docker without it? Does HomeKit wire then?