Port problem of the combination of SpringCloud and docker

now I have a code for cloud disk service with port 8089. Now I want to instance two containers on one server, and then map container port 8089 to host 8080808081, but the cloud disk service in both containers is port 8089, and the port registered to eureka is 8089. Unable to access the host on port 8080pl 8081. Now I want to access the cloud disk service of these two containers, what should I do?
there is an idea that two containers correspond to different ports, such as
* Container 1 Port 8089 Mapping Host 8089
Container 2 Port 8090 Mapping Host 8090 *
but if I want to dynamically add 3 containers, so I have to modify the application.yml port and repackage each time. I would like to ask if there is a better plan for rapid deployment.

Feb.28,2021

the mapping port can publish the container port to the host through-p 8080 answer 8089. Internal access is still carried out through 8089, and there is no conflict.


what is the use of this registry?


Top, the same problem, find a solution

Menu