Home > Software design >  What is running on host.docker.internal host?
What is running on host.docker.internal host?

Time:07-03

I'm just curious, what is running on host.docker.internal host?

This service routes packages from docker container to services on host network.

But what exactly is it ?

I found out that its not gateway.

CodePudding user response:

I'll answer with a few things that I've found regarding the Linux implementation. I bet that the implementation details for Docker for Windows / Mac will be different.

In short: host.docker.internal is a Name. Every service that runs on your host and binds to the network interface that is also set as the Docker Daemon host-gateway, it can be accessed from inside a container at host.docker.internal:[service_port].

Example

$ docker run -it --rm --add-host=host.docker.internal:host-gateway alpine
/ # cat /etc/hosts
127.0.0.1   localhost
... (it has a few other lines here) ...
172.17.0.1  host.docker.internal            
  • Related