Skip to content

Commit 120bb3b

Browse files
committed
Resolve host.docker.internal from all containers
1 parent fbc19f9 commit 120bb3b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/interceptors/docker/docker-networking.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,18 @@ class DockerNetworkMonitor {
174174
// Merge the sets for the same hostname in multiple networks together, to create
175175
// a single mapping from hostnames to all possible addresses. This isn't great,
176176
// but hopefully in practice there will be few or zero conflicts regardless.
177-
return _.assignWith<{ [hostname: string]: Set<string> }>({},
177+
const aliasMapping = _.assignWith<{ [hostname: string]: Set<string> }>({},
178178
...Object.values(this.aliasMappings),
179179
(existingIps: Set<string> = new Set(), nextIps: Set<string> = new Set()) => {
180180
return new Set([...existingIps, ...nextIps]);
181181
}
182182
);
183+
184+
return {
185+
...aliasMapping,
186+
// Host.docker.internal is always supported as an alias for us, the host OS
187+
'host.docker.internal': new Set(['127.0.0.1'])
188+
};
183189
}
184190

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

0 commit comments

Comments
 (0)