Skip to content

Commit 1d60139

Browse files
committed
Update Dockerode to support user-only sockets on new Mac Docker Desktop
1 parent fbf74ce commit 1d60139

File tree

3 files changed

+110
-53
lines changed

3 files changed

+110
-53
lines changed

package-lock.json

+100-49
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"destroyable-server": "^1.0.0",
6363
"dns2": "^2.0.1",
6464
"docker-file-parser": "^1.0.5",
65-
"dockerode": "^3.3.1",
65+
"dockerode": "^4.0.0",
6666
"env-paths": "^1.0.0",
6767
"event-stream": "^4.0.1",
6868
"express": "^4.17.3",

src/interceptors/docker/docker-proxy.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,15 @@ async function createDockerProxy(
7878

7979
// Hacky logic to reuse docker-modem's internal env + OS parsing logic to
8080
// work out where the local Docker host is:
81-
const modem = docker.modem as any as ({ socketPath: string } | { host: string, port: number });
82-
const dockerHostOptions = 'socketPath' in modem
83-
? { socketPath: modem.socketPath }
81+
const modem = docker.modem as any as ({
82+
getSocketPath(): undefined | Promise<string>;
83+
host: string;
84+
port: number;
85+
});
86+
87+
const modemSocketPath = await modem.getSocketPath();
88+
const dockerHostOptions = modemSocketPath
89+
? { socketPath: modemSocketPath }
8490
: { host: modem.host, port: modem.port };
8591

8692
const agent = new http.Agent({ keepAlive: true });

0 commit comments

Comments
 (0)