Little mini note:
I run esphome for HASS in a container, but just in host network mode to help with mdns things etc.
Docker and IPv6 (especially in dynamic networks, without guarantees of fixed v6 prefixes) is a whole other situation. But, host networking mode somewhat sidesteps that and you can get away with v6 in host networking mode being available to dockerized processes without needing to faff with IPv6 toggles in the docker daemon config.
esphome's dashboard still binds to 0.0.0.0 (all IPv4), though, meaning it doesn't bind to IPv6.
It does provide an --address
argument to the main esphome startup, which you can toss into the docker compose command
.
But, the underlying tornado app listen / startup was unhappy with how I was specifying an "all IPv6 bind" here. I figured [::]
was sensible here, but tornado wasn't happy with that, e.g.:
esphome | File "/usr/local/lib/python3.12/site-packages/tornado/netutil.py", line 105, in bind_sockets
esphome | socket.getaddrinfo(address, port, family, socket.SOCK_STREAM, 0, flags),
esphome | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
esphome | File "/usr/local/lib/python3.12/socket.py", line 978, in getaddrinfo
esphome | for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
esphome | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
esphome | socket.gaierror: [Errno -2] Name or service not known
Turns out, you just need a straight up "::
" without the hard brackets:
esphome:
command:
- "dashboard"
- "/config"
- "--address"
- "::"
So, 🤷
A small little thing, but helpful to now also have esphome listening on v6:
$ sudo ss -anplt | grep 6052
LISTEN 0 128 [::]:6052 [::]:* users:(("esphome",pid=209909,fd=6))