Two spring cloud project images, one is config Configuration Center and the other is eureka Service Governance.
The configuration parameters of eureka should be taken from config, and the config address in eureka is the config host address and the corresponding port.
Starting with dockercompound, noroutohost appears in eureka log and config service cannot be accessed.
But! I tried to start two tasks through docker run, and there was no problem.
Does a great god know why and how to solve it?
I tried two services to write two docker-compose files respectively to start, as a result, eureka changed an exception when accessing config, connection refused
- It is estimated that the service is not ready yet.
Service aDepend on
docker composeIn the process of starting the service, it can ensure that
Service bContainer precedes
Service aThe container starts, but cannot be guaranteed directly.
Service bPrior to
Service aReady. such as
Service bThe container will not be ready until one second after it is started, and
Service aIt will be ready 200 milliseconds after the container is started, so even if
Service bIt’s no use starting it first.
- Control startup order in Compose