IP address of the service inside docker

IP address of the service inside docker

When the application that you run inside docker need the server private and public IP address to communicate, what will be the values of the IP address?

For instance:

If the private and public ip of the server on which the docker container is running is the following:

private ip: 10.0.0.1 public ip: 192.168.9.5

If I configure the above details in the application which is suppose to run inside a docker container, will it work?

In my case, the application is terminated without any error.

решение1

It depends on what the application is using it for. If it's binding to that address to listen too, it will not work because it can't see the interface, and you should use 0.0.0.0 for the "public ip"; if it just needs the IP to redirect clients or something, you should use your real public IP.

Связанный контент