Skip to content

Commit 3e11897

Browse files
committed
fix: return a valid docker host for docker desktop
1 parent 4a1b428 commit 3e11897

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎apps/dokploy/server/utils/docker.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,20 @@ export const isWSL = async () => {
1111
}
1212
};
1313

14+
/** Returns if running in Docker Desktop. */
15+
export const isDockerDesktop = async () => {
16+
try {
17+
const { stdout } = await execAsync("getent hosts host.docker.internal");
18+
return !!stdout.trim();
19+
} catch {
20+
return false;
21+
}
22+
};
23+
1424
/** Returns the Docker host IP address. */
1525
export const getDockerHost = async (): Promise<string> => {
1626
if (process.env.NODE_ENV === "production") {
17-
if (process.platform === "linux" && !(await isWSL())) {
27+
if (process.platform === "linux" && !(await isWSL() || await isDockerDesktop())) {
1828
try {
1929
// Try to get the Docker bridge IP first
2030
const { stdout } = await execAsync(

0 commit comments

Comments
 (0)