Skip to content

Commit 5b02dbf

Browse files
committed
Ensure host.docker.internal resolves on Windows & Mac
1 parent b16c03c commit 5b02dbf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/interceptors/docker/docker-networking.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ class DockerNetworkMonitor {
210210

211211
// The list of mappings per-network, binding aliases to their (0+) target IPs
212212
get aliasIpMap(): { [host: string]: ReadonlySet<string> } {
213-
return combineSetMaps(...Object.values(this.networkTargets));
213+
return combineSetMaps(...Object.values(this.networkTargets), {
214+
// The Docker hostname always maps to the host's localhost, and it's not automatically included
215+
// on platforms (Windows & Mac) where Docker resolves it implicitly.
216+
[DOCKER_HOST_HOSTNAME]: new Set(['127.0.0.1'])
217+
});
214218
}
215219

216220
onEvent = async (event: DockerEvent) => {

0 commit comments

Comments
 (0)