fix: auto-detect Docker network name for tunnel and container connect

Docker Compose prefixes network names with the project directory name
(e.g. 'headquarter_backend' instead of 'backend'). The previous code
hardcoded 'backend', causing 'network not found' errors.

- apps/api/src/services/docker.py: add get_backend_network_name() that
  inspects the API container (hq-api) to find the actual network name
- apps/api/src/services/docker.py: connect_container_to_network() now
  auto-detects the network name when not explicitly provided
- apps/api/src/services/tunnel.py: import and use get_backend_network_name()
- apps/api/src/api/tool_instances.py: remove explicit 'backend' arg from
  connect_container_to_network() call

Quality gates: ruff clean
This commit is contained in:
2026-05-30 14:00:31 +02:00
parent 9cab8c7bc7
commit cc52811522
3 changed files with 42 additions and 5 deletions
+1 -1
View File
@@ -1733,7 +1733,7 @@ async def start_instance(
logger.debug(
"Connecting container %s to backend network...", expected_container_name
)
connected = connect_container_to_network(expected_container_name, "backend")
connected = connect_container_to_network(expected_container_name)
if connected:
logger.debug(
"Successfully connected %s to backend network", expected_container_name