feat: enable container access to host localhost services

Rewrite localhost/127.x.x.x/0.0.0.0 target URLs to use host.docker.internal,
allowing the container to reach services running on the host machine.

- Add extra_hosts mapping for host.docker.internal on Linux
- Add HOST_GATEWAY env var to container
- Add rewrite_localhost_targets() to transform localhost URLs
- Support full 127.0.0.0/8 loopback range and IPv6 ::1
This commit is contained in:
0xallam
2026-01-07 12:04:21 -08:00
committed by Ahmed Allam
parent 96a7b00d6c
commit f2138c87f8
3 changed files with 50 additions and 1 deletions
+3 -1
View File
@@ -30,9 +30,10 @@ from strix.interface.utils import (
image_exists,
infer_target_type,
process_pull_line,
rewrite_localhost_targets,
validate_llm_response,
)
from strix.runtime.docker_runtime import STRIX_IMAGE
from strix.runtime.docker_runtime import HOST_GATEWAY_HOSTNAME, STRIX_IMAGE
from strix.telemetry.tracer import get_global_tracer
@@ -377,6 +378,7 @@ Examples:
parser.error(f"Invalid target '{target}'")
assign_workspace_subdirs(args.targets_info)
rewrite_localhost_targets(args.targets_info, HOST_GATEWAY_HOSTNAME)
return args