[docker] Add support for binding dashboard to network interface #11876
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this implement/fix?
This allows to bind esphome dashboard to a specific network interface within docker.
Access to the esphome dashboard should be protected, as it provides direct access to secrets.
While this can be done with username & password, it is less convenient than offloading that to a reverse proxy and leverage OIDC for seamless SSO.
At the same time, esphome needs direct line of sight with the devices it manages for mdns discovery.
Until now satisfying the 2 conditions was tricky, because the dashboard could not be restricted to a specific interface. While esphome support binding the dashboard to a given ip address (https://esphome.io/guides/cli/#dashboard-command --address) the ip address is oftentimes dynamic in docker.
This PR introduces the following environment variable for docker:
DASHBOARD_LISTENING_NETWORK_INTERFACE. When set to the name of the interface (i.e.eth0) the dashboard will only listen on the ip address of that given interface.Types of changes
Checklist:
If user exposed functionality or configuration variables are added/changed:
I will update the documentation accordingly - once there is a consensus about the implementation.