0
Docker-Compose.yml
version: '3.5'
services:
  marvel-api:
    build: my-api
    container_name: my-api
    depends_on:
      - my-api-bd
    restart: always
    ports:
      - 8080:8080
  my-api-bd:
    build: my-api-bd
    restart: always
    container_name: my-api-bd
    ports: 
      - 3306:3306
    expose: 
      - 3306
The containers begin to rise simultaneously, where the my-api requests access to the bank even before it finishes climbing, causing Exception: java.net.ConnectException: Connection refused (Connection refused) is there a native way of waiting for each other? As you can see, to paleactively solve the problem, I used the restart: always but I feel that this is not a very beautiful solution...