Rootless container: access host vHosts via host.containers.internal?
Hey,
I'm trying to access HTTP resources from within a rootless container running on the host, but the setup relies on VirtualHosts (vHosts).
When I try to call http://host.containers.internal, I get the wrong virtual host/resource.
Is there a way to assign additional hostnames to host.containers.internal, such as sub.domain.tld?
I've tried using the AddHost option within Quadlets, but it only accepts IP addresses (AddHost=sub.domain.tld:host.containers.internal doesn’t work).
Currently, I’ve identified two workarounds — neither of which seems ideal:
- Enable
Network=slirp4netns:allow_host_loopback=true. With this, I’m able to reachhttp://sub.domain.tld, but usingslirp4netnsprevents defining a custom network. - Set
AddHost=sub.domain.tld:169.254.1.2. The IP address works, but it’s static and may change between setups or Podman versions.
Has anyone found a cleaner solution to achieve this?
Posted Nov 9, 2025, 9:00 AM UTC
32