How to deactivate Random port mapping using Docker Compose and Spring Boot? (Jetbrains example project)

Answered

Good day,

as shown in the jetbrains example below, I tried to set up a docker-compose project with a database and a spring boot application as services. I cloned the project form git and followed the instructions on the Jetbrains-hompage:

https://www.jetbrains.com/help/idea/run-and-debug-a-spring-boot-application-using-docker-compose.html

In the docker-compose.yaml, I added the entry “ports”, in the Dockerfile the entry “EXPOSE”, the rest was left as it was:

[…]
services:
  java:
   […]
    ports:
      - “8080:8080”

[…]

But still, on starting the service “java” in debug-mode, Intellij gives me the notice:

“Application port 8080 is bound to local port x”, x being a random number. 

How can I deactivate the random port mapping?

Regards.

0

Please sign in to leave a comment.