fix: invalid docker host while using docker desktop#4171
Open
rpoetrap wants to merge 2 commits intoDokploy:canaryfrom
Open
fix: invalid docker host while using docker desktop#4171rpoetrap wants to merge 2 commits intoDokploy:canaryfrom
rpoetrap wants to merge 2 commits intoDokploy:canaryfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.internalavailable and should use that instead. A newisDockerDesktophelper detects this by checking whetherhost.docker.internalresolves viagetent hosts. ThegetDockerHostfunction 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:
canarybranch.Issues related (if applicable)
N/A
Screenshots (if applicable)
N/A
Greptile Summary
Adds an
isDockerDesktophelper that probesgetent hosts host.docker.internaland uses it alongside the existingisWSLcheck to skip the Linux bridge-IP path ingetDockerHost, fixing Docker host resolution for Docker Desktop on macOS/Windows. The detection logic is sound: Dokploy does not injecthost.docker.internalinto native Linux containers, so false positives are not a concern, and thecatch-returning-falsefallback safely handles environments wheregetentis 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
(2/5) Greptile learns from your feedback when you react with thumbs up/down!