skip to Main Content

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]

here is my github issue link

source code for the above

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.

2

Answers


  1. Chosen as BEST ANSWER

    Solution:

        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


  2. Can you add docker compose logs, when you run docker compose up for the first time? It will be easier to detect the problem.

    Or check that helthcheck woks correctly.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search