pub fn rewrite_local_url_for_container(local_url: &str) -> StringExpand description
Rewrite a host-loopback AGENTMUX_LOCAL_URL (e.g. http://127.0.0.1:PORT)
into something a container’s network namespace can actually reach.
docker exec over the Docker socket never inherits the host process’s
env the way a host subprocess does, so a container agent gets no sidecar
URL at all unless one is explicitly injected — and injecting the
loopback value verbatim would be reachable from the srv process but not
from inside the container. host.docker.internal is resolvable from
Docker Desktop (macOS/Windows) automatically, and from native Linux via
the extra_hosts: host.docker.internal:host-gateway entry
create_and_start sets — see #2939 workstream 1.
Only rewrites 127.0.0.1/localhost; any other host (already a real
hostname/IP, or already host.docker.internal) passes through
unchanged, so this is safe to call unconditionally.