Environment:
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.
Question:
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?
1.15 update
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.
- Hypothesis
Service a
Depend onService b
,docker compose
In the process of starting the service, it can ensure thatService b
Container precedesService a
The container starts, but cannot be guaranteed directly.Service b
Prior toService a
Ready. such asService b
The container will not be ready until one second after it is started, andService a
It will be ready 200 milliseconds after the container is started, so even ifService b
It’s no use starting it first.- Control startup order in Compose