When the microservice starts, it will automatically report its ip and port to the service registration center. However, the service runs in the docker container, and the registered ip becomes the docker internal ip at the beginning of 172, which cannot be accessed by other machines.
Is it necessary to manually change the address registered by the service to the address and port of the host? Is there any other good solution
—– update —–
After Docker version 1.12, engine has swarm mode. After testing, the overlay network using swarm can solve the problem of cross-host communication. Is this scheme suitable
The overlay network provided by docker swarm can provide inter-host intra-container network communication. The local content device can specify the network to form an internal network at startup. Then nginx can be deployed in host mode on swarm host, and dynamic service discovery can be achieved by using etcd, consul and other dynamic registration services and updating nginx’s reverse proxy configuration.
However, overlay currently has the highest performance loss of all cross-host communication modes, reaching 60%. Some people have done tests online, you can look for them. Therefore, for the time being, kubernetes or mesos should be considered in the production environment.