Docker compose issue with swagger-server Hi all, I am facing an issue with an issue with swagger boot when you running $ docker-compose up.
I am using a centralized swagger for microservices it is working fine when running locally but when I am running the same application with docker-compose I need to re run my swagger-server service container manually after docker compose up.
the issue is that when I am running all my microservice with docker-compose I am unable hit any end point on port which is running swagger-server. When I am hitting any port I am getting
this page isn't working right now local host didn't send any data
swagger-server:
image: tejajagadeep/movie-app-swagger-server:latest
container_name: swagger-server
environment:
- eureka.client.service-url.defaultZone=http://eureka-server:8761/eureka
- spring.config.import=optional:configserver:http://config-server:8888/
ports:
- "8769:8769"
networks:
- my-movie-network
depends_on:
- eureka-server
- config-server
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8769/actuator/health"]
interval: 20s
timeout: 10s
retries: 10
but if re run my swagger-server image it is working fine. ( I am using open docs web mvc dependency in my spring boot swagger server]
How can I resolve this issue I don't think there is any issue with the code cause I have everything in the application property itself.
As mentioned in the comments the issue is with it is starting before dependent services so I am adding this command will not let it start until the config server starts and is healthy.
entrypoint: sh -c "apk --no-cache add curl && /bin/sh -c 'until curl -sSf http://config-server:8888/actuator/health; do echo \"Waiting for config-server to be healthy...\"; sleep 5; done' && java -jar /usr/src/swagger-server-0.0.1-SNAPSHOT.jar"
I added this which solved the issue which also solved other service re running because of on-failure line.