Skip to content

show_toolbar_with_docker doesn't work on orbstack #2419

Description

@alastair

hi!
On orbstack, docker.host.local resolves to 0.250.250.254 (https://github.com/orgs/orbstack/discussions/1829)
This means that the check in middleware.show_toolbar_with_docker doesn't successfully compute the host IP address and the toolbar doesn't show.

While the code does call out "This is not guaranteed to work.", it might be nice for it to try both approaches, especially given that this is a custom "only for use in docker" callback anyway.
I'm successfully using the following in my callback. Because we can't get a "real" IP for the host I just guess the gateway based on the container IP. In my testing with 20 different compose stacks on my computer every stack gets its own /24, so this assumption holds.

      container_ips = socket.gethostbyname_ex(socket.gethostname())[2]
      gateways = {ip.rsplit(".", 1)[0] + ".1" for ip in container_ips}
      return request.META.get("REMOTE_ADDR") in gateways

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions