Skip to content

fix: resolve host IP from Docker bridge network for Rancher Desktop compatibility#888

Open
octo-patch wants to merge 1 commit intokatanemo:mainfrom
octo-patch:fix/issue-561-rancher-desktop-support
Open

fix: resolve host IP from Docker bridge network for Rancher Desktop compatibility#888
octo-patch wants to merge 1 commit intokatanemo:mainfrom
octo-patch:fix/issue-561-rancher-desktop-support

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #561

Problem

--add-host host.docker.internal:host-gateway works on Docker Desktop and standard Docker Engine but not on Rancher Desktop, where the host-gateway special keyword is not recognised. As a result, the Plano container cannot reach services running on the host machine when started via planoai up on Rancher Desktop.

Solution

Introduce a _get_host_ip() helper in cli/planoai/docker_cli.py that reads the gateway IP of the default Docker bridge network (e.g. 172.17.0.1) using docker network inspect bridge. This is the same IP that host-gateway resolves to on standard installations, but uses a concrete address that is universally understood — including by Rancher Desktop.

If the network inspect fails for any reason (Docker not running, custom network setup, etc.) the function falls back to host-gateway, preserving backward compatibility.

Testing

  • Added unit tests in cli/test/test_docker_cli.py covering:
    • Bridge gateway IP returned on success
    • Fallback to host-gateway on subprocess failure
    • Fallback to host-gateway on empty output
  • All 3 tests pass (uv run pytest test/test_docker_cli.py)

…ompatibility (fixes katanemo#561)

`--add-host host.docker.internal:host-gateway` works on Docker Desktop
and standard Docker Engine but not on Rancher Desktop, where the
`host-gateway` keyword is not recognised.

Introduce `_get_host_ip()` which reads the gateway of the Docker bridge
network (e.g. 172.17.0.1) — a portable, concrete IP that works across
Docker Desktop, Docker Engine, and Rancher Desktop.  If the network
inspect fails for any reason the function falls back to `host-gateway`,
preserving the existing behaviour for standard installations.

Also add unit tests covering the success path, subprocess failure, and
empty-output fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for rancher desktop

1 participant