Docker compose-up SpringBoot Mysql

  docker, mysql, spring

m new in docker i;m watching videos on youtube and i want make my first container, of course it’s a lot of problem.

this is my error.

enter image description here

docker-compose.yml:

version: "3.2"
 services:

   autoshop:
    container_name: autoshop-spring
    image: autoshop
    restart: on-failure
    depends_on:
      - autoshopdb
    ports:
      - "8081:8080"

  autoshopdb:
    image: mysql
    container_name: autoshopdb
    environment:
      MYSQL_ROOT_PASSWORD: dominik372
      MYSQL_DATABASE: shopspring
      MYSQL_USER: root
      MYSQL_PASSWORD: dominik372
    ports:
      - "3307:3306"

application.proporties

server.port=8080
spring.datasource.url=jdbc:mysql://autoshopdb:3306/shopspring?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=dominik372
#spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

and this is my Dockerfile

FROM openjdk:15-jdk-alpine
ADD target/autoshop-0.0.1-SNAPSHOT.jar autoshop-0.0.1-SNAPSHOT.jar
EXPOSE 8080
CMD java -jar autoshop-0.0.1-SNAPSHOT.jar

i need help !

Source: Docker Questions

LEAVE A COMMENT