w0051977
w0051977

Reputation: 15817

What is the IP address generated by the Windows container?

When I create a Docker file in Visual Studio and launch it; the following happens:

If it is a Windows container then when I run the application (with docker-compose as the startup project), then it launches: http://172.22.15.37/ (IP address changes each time).

What is this IP address and why can I browse to it when using a Windows container, but not a Linux container? I cannot find it using ipconfig.

The reason I ask is because this does not appear to happen with the Linux container, which browses straight to the local port: http://localhost:30500.

It confuses me even more when I create a Linux container in Visual Studio and run the following command: docker-inspect {container name}. Here I can find the IP address of the container. When using a windows container I can browse to this IP address on port 80, however when using a Linux container I cannot browse on port 80.

I have spent several hours Googling this, however I cannot find the answer.

Upvotes: 1

Views: 516

Answers (1)

user9008857
user9008857

Reputation:

Yes, it's true.

The allocation of container IP addresses in Windows is different from the allocation container IP addresses in Linux. In Docker for Windows, the container communicates through a vEthernet adapter called DockerNAT.

Please run ipconfig in cmd at try to find Ethernet adapter vEthernet (DockerNAT).

From version 18.03, you can use DNS name host.docker.internal, which resolves to the internal IP address used by the host.

I think, the following lecture will be helpful for you:

https://github.com/docker/for-win/issues/221

Docker ip for windows

Upvotes: 1

Related Questions