Configure remote debug using kotlin spring and docker

Hi I have a problem to configure debug in my application, I use spring boot with kotlin using docker, follow my configuration files:

Dockerfile

FROM  gradle:6.4-jdk14

RUN apt-get update && apt-get install -qq -y --no-install-recommends

ENV INSTALL_PATH /weblib

RUN mkdir -p $INSTALL_PATH

WORKDIR $INSTALL_PATH

COPY . .

RUN gradle clean && gradle bootJar

docker-compose.yml

version: “3.8”

services:
weblibdb:
image: “postgres:12.3”
environment:
- POSTGRES_DB=weblib
- POSTGRES_USERNAME=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- postgres:/var/lib/postgresql/data
weblibapi:
build: .
command: bash start.sh
ports:
- “8090:8090”
- “5005:5005”
environment:
- POSTGRES_USERNAME=postgres
- POSTGRES_PASSWORD=postgres
- GRADLE_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=*:5005
volumes:
- .:/weblib
depends_on:
- weblibdb

volumes:
postgres:

start.sh

gradle bootRun

my container works fine and the remote debug created in IDE connect with container but breakpoints not work, follow my configuration:

thank you

I change my configurations and works, follow my changes:

remove the follow commands from Dockerfile:

RUN gradle clean && gradle bootJar

change my start.sh to:

gradle clean
gradle bootJar
java -jar -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 build/libs/weblib.jar

I a docker-compose.yml I change suspend=y to suspend=n in enviroment GRADLE_OPTS , but it’s optional.