host.docker.internal

2022-12-19

Here's a rarely talked about feature of Docker - the special DNS name host.docker.internal.

What it does is point to the IP address used by the host, making it possible to connect to services on the host - even other docker containers, provided they have appropriate ports published.

Normally there shouldn't be a need to use this, but it's a life saver when you're using the WSL2 backend and networking on your work laptop is intentionally crippled due to corporate security policy.