Docker compose com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

I tried to implement an example of Spring Boot Microservice examples.
I have a problem in docker-compose file.

Eureka server and api gateways throws an issue defined below while there is no issue in config server.

Here is the issue : com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

Here is the code snippets for config server.

configserver:
    image: configserver
    container_name: configServer
    build:
      context: ./configserver
      dockerfile: Dockerfile
    environment:
      CONFIGSERVER_URI: "http://localhost:9191"
      CONFIGSERVER_PORT: "9191"
    ports:
      - "9191:9191"
    networks:
      backend:
        aliases:
          - "configserver"

Here is the code snippets for eureka server

eurekaserver:
    image: eurekaserver
    ports:
      - "8761:8761"
    build:
      context: ./discoveryserver
      dockerfile: Dockerfile
    environment:
      CONFIGSERVER_URI: "http://localhost:9191"
      CONFIGSERVER_PORT: "9191"
      EUREKASERVER_URI: "http://localhost:8761/eureka/"
      EUREKASERVER_PORT: "8761"
    depends_on:
      configserver:
        condition: service_started
    networks:
      backend:
        aliases:
          - "eurekaserver"

Here is the code snippets for api gateway server.

gatewayserver:
    image: gatewayserver
    ports:
      - "8600:8600"
    build:
      context: ./api-gateway
      dockerfile: Dockerfile
    environment:
      PROFILE: "default"
      SERVER_PORT: "8600"
      CONFIGSERVER_URI: "http://localhost:9191"
      EUREKASERVER_URI: "http://localhost:8761/eureka/"
      EUREKASERVER_PORT: "8761"
      CONFIGSERVER_PORT: "9191"
    depends_on:
      configserver:
        condition: service_started
      eurekaserver:
        condition: service_started
    networks:
      backend:
        aliases:
          - "gateway"

Here is all docker-compose.yml : Link
Here are some screenshots to show logs : Link

Again, this is a Java error. You should try to get help on a Java forum. I can’t talk on behalf of anyone else, but I don’t have time to search for java error messages and understand someone else’s code. If you know what throws the error message and what is missing from the image, then maybe we can help you to understand whyt that is missing.

Ok. I got that you have no idea about docker and spring boot.

I removed localhost in this line and revised it shown below spring.config.import=optional:configserver:http://configserver:9191/

I removed localhost in application.properties file under config server and revised mysql connection shown below.

spring.datasource.url=jdbc:mysql://database:3306/springbootadvertisement?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Turkey

eureka.client.serviceUrl.defaultZone=http://eurekaserver:8761/eureka

```. I changed it but I still got the same issue.