0
votes

I created a docker-compose.yml file in the root path as shown below

version : "3"
services:
  db:
    container_name: spring-db
    image: mysql
    platform: linux/x86_64    # 추가된 라인
    environment:
      MYSQL_DATABASE: spring_db
      MYSQL_USER: spring_db
      MYSQL_PASSWORD: spring_pw
      MYSQL_ROOT_PASSWORD: root_pw
    volumes:
      - ./db/data:/var/lib/mysql:rw
    ports:
      - "3306:3306"
    restart: always
  app:
    container_name: spring-app
    image: openjdk:11-jdk
    ports:
      - "8080:8080"
    volumes:
      - ./app:/app
    working_dir: /app
    command: ["./gradlew", "bootrun"]
    depends_on:
      - db
    restart: always

After creation, when I run docker-compose up -d in the project root, mysql succeeds, but the app project returns an error.

Upgrade


Sign in

spring-app
openjdk:11-jdk
RUNNING





Downloading https://services.gradle.org/distributions/gradle-7.4.1-bin.zip

...........10%...........20%...........30%...........40%...........50%...........60%...........70%...........80%...........90%...........100%


Welcome to Gradle 7.4.1!


Here are the highlights of this release:

 - Aggregated test and JaCoCo reports

 - Marking additional test source directories as tests in IntelliJ

 - Support for Adoptium JDKs in Java toolchains


For more details see https://docs.gradle.org/7.4.1/release-notes.html


Starting a Gradle Daemon (subsequent builds will be faster)

> Task :compileKotlin

> Task :compileKotlin UP-TO-DATE

> Task :compileJava NO-SOURCE

> Task :processResources UP-TO-DATE

> Task :classes UP-TO-DATE

> Task :bootRunMainClassName UP-TO-DATE


> Task :bootRun FAILED

4 actionable tasks: 1 executed, 3 up-to-date

​
Search…
Stick to bottom

Please check the code and errors, bootrun fails and I don't know exactly where to fix it. I am practicing how to set up the server simply using docker-compose. I just need to open the server using docker-compose with simple api code in Spring Boot, but I am unable to proceed in the above situation.