-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
I was writing a sample application to show how tracing works with the new Micrometer support. For this I have 2 Spring Boot applications which need to connect to the same Zipkin instance. I figured to use the Docker Compose support to have both connect to the same running container. I was not able to accomplish this.
Each application will create it's own network (despite a network being added to the compose.yaml
) and as such isn't able to start the container (depending on which application starts first the last one fails).
I also tried to remove the explicit network but then one is generated as well.
Tried to explicitly name the container, which fails as the names have to be unique and it will not connect to the other container.
I also played around with doing START instead of UP but that doesn't yield any better result either.
So I'm probably doing something with the support that it wasn't (or isn't currently) designed for.
version: '3'
services:
zipkin:
image: openzipkin/zipkin
ports:
- "9411:9411"
The result is 2 networks and a failing application.
So I hoped that a explicitly defined network would do the trick, but the network (judging from the output) is still prefixed with the project name.
2023-10-14T11:40:24.560+02:00 INFO 25467 --- [utReader-stderr] [ ] o.s.boot.docker.compose.core.DockerCli : Network recipe_9_4_i_a_recipe_9_4 Creating
2023-10-14T11:40:24.616+02:00 INFO 25467 --- [utReader-stderr] [ ] o.s.boot.docker.compose.core.DockerCli : Network recipe_9_4_i_a_recipe_9_4 Created
2023-10-14T11:40:24.617+02:00 INFO 25467 --- [utReader-stderr] [ ] o.s.boot.docker.compose.core.DockerCli : Container recipe_9_4_i_a-zipkin-1 Creating
2023-10-14T11:40:24.654+02:00 INFO 25467 --- [utReader-stderr] [ ] o.s.boot.docker.compose.core.DockerCli : Container recipe_9_4_i_a-zipkin-1 Created
2023-10-14T11:40:24.665+02:00 INFO 25467 --- [utReader-stderr] [ ] o.s.boot.docker.compose.core.DockerCli : Container recipe_9_4_i_a-zipkin-1 Starting
2023-10-14T11:40:24.937+02:00 INFO 25467 --- [utReader-stderr] [ ] o.s.boot.docker.compose.core.DockerCli : Container recipe_9_4_i_a-zipkin-1 Started
2023-10-14T11:40:24.938+02:00 INFO 25467 --- [utReader-stderr] [ ] o.s.boot.docker.compose.core.DockerCli : Container recipe_9_4_i_a-zipkin-1 Waiting
2023-10-14T11:40:30.442+02:00 INFO 25467 --- [utReader-stderr] [ ] o.s.boot.docker.compose.core.DockerCli : Container recipe_9_4_i_a-zipkin-1 Healthy
I can imagine that in a microservice environment it is (sometimes) needed to run multiple applications which share a container, like Zipkin in this example. It would be nice if this code be made possible through the docker compose support.
As a workaround I now manually start zipkin and configure it in the application.properties
but it does away from the checkout and run experience.