Problem/Justification
It would be great to reliable access the TrueNAS (Docker) host via network, no matter the external network status and ip address.
When trying to access the TrueNAS WebUI (or apps on TrueNAS on an exposed port), I have to either type in the external IP address, something like 192.168.0.201. Or I have to activate the “Host Network” option for the app, to be able to use 127.0.0.1.
In the first scenario, the setup can break when the external IP address changes. Reboots, network changes, relocation, etc. can all cause this.
The second scenario works more dynamically in more situation. It would still be preferable to not use “Host Network” mode.
Impact
host.docker.internal is natively setup and usable on Windows and macOS machines. This allows accessing the host machine via the hostname host.docker.internal. This works no matter what external IP address is used or which internal Docker IP the host is assigned.
On Linux it needs to be manually configured with the following addition to a docker-compose.yml:
extra_hosts:
- "host.docker.internal:host-gateway"
Having this configuration automatically set for each app would allow for more flexible use-cases and configuration, that doesn’t have to be adjusted to each TrueNAS instance and network setup.
If there are any downsides to roll it out to all apps, it could be added as an option, akin to “Host Network” mode.
User Story
Running a cloudflared or Newt (Pangolin) app, it would be possible to access the TrueNAS WebUI (or apps via their exposed port), buy leveraging host.docker.internal as the hostname.
Context
- Docker docs: dockerd | Docker Docs
- Example configuration steps: Host Docker Internal in Linux | Delft Stack
- Similar forum thread: How to set `host.docker.internal:host-gateway` in the wizard?
- Similar question on Reddit: Reddit - The heart of the internet