version: "3"
services:
  springboot:
    build:
      context: ./
      dockerfile: ./Dockerfile
    image: springboot
    networks:
      - spring
    ports:
      - "8081:8081"
      - "5005:5005"
    volumes:
      - "./springboot:/home/spring_curso"
    environment:
      - ADDITIONAL_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -Xmx1G -Xms128m -XX:MaxMetaspaceSize=128m
      - PROFILE=dev
  db:
    image: mysql
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: senha
    networks:
      - spring
    ports:
      - 33060:3306
  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080
    networks:
      - spring
networks:
  spring:
    driver: bridge
o problema que ocorre e que quando dou o docker-compose up --build --force-recreate ele criar o db, adminer e executa e fica online mas quando chega no springboot e não consegue logar no mysql, alguem já teve esse problema, ou sabem de alguma alternativa?
spring.datasource.url=jdbc:mysql://localhost:3306/spring
spring.datasource.username=root
spring.datasource.password=senha
spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect