Skip to content

fix: invalid docker host while using docker desktop#4171

Open
rpoetrap wants to merge 2 commits intoDokploy:canaryfrom
rpoetrap:fix/docker-host
Open

fix: invalid docker host while using docker desktop#4171
rpoetrap wants to merge 2 commits intoDokploy:canaryfrom
rpoetrap:fix/docker-host

Conversation

@rpoetrap
Copy link
Copy Markdown

@rpoetrap rpoetrap commented Apr 7, 2026

What is this PR about?

This PR fixes the Docker host resolution logic for users running Dokploy via Docker Desktop (macOS and Windows). Previously, the code assumed any Linux environment that wasn't WSL should use the Docker bridge IP — but containers running under Docker Desktop also have host.docker.internal available and should use that instead. A new isDockerDesktop helper detects this by checking whether host.docker.internal resolves via getent hosts. The getDockerHost function now skips the bridge IP path when either WSL or Docker Desktop is detected, ensuring a valid Docker host is returned in all cases.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related (if applicable)

N/A

Screenshots (if applicable)

N/A

Greptile Summary

Adds an isDockerDesktop helper that probes getent hosts host.docker.internal and uses it alongside the existing isWSL check to skip the Linux bridge-IP path in getDockerHost, fixing Docker host resolution for Docker Desktop on macOS/Windows. The detection logic is sound: Dokploy does not inject host.docker.internal into native Linux containers, so false positives are not a concern, and the catch-returning-false fallback safely handles environments where getent is unavailable.

Confidence Score: 5/5

Safe to merge — the logic is correct and the only remaining finding is a minor performance suggestion.

No P0 or P1 issues. The isDockerDesktop check correctly identifies Docker Desktop environments via getent, the operator precedence in !(await isWSL() || await isDockerDesktop()) is correct (De Morgan: !A && !B), and the catch block gracefully handles environments where getent is unavailable.

No files require special attention.

Reviews (1): Last reviewed commit: "fix: return a valid docker host for dock..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

@rpoetrap rpoetrap requested a review from Siumauricio as a code owner April 7, 2026 06:13
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant