I have a host that runs a native mysql installation (not a container).
From a docker container I now want to connect from a java spring-boot application to that port (3306 by default).
But it does not work:
docker-compose.yml:
version: '3.7'
services:
  customer-app:
    ports:
      - "3306:3306"
    environment:
      SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/db         
  
Result from docker-compose up:
Cannot start service customer-app: driver failed programming external connectivity on endpoint:
Error starting userland proxy: listen tcp4 0.0.0.0:3306: bind: address already in use
This is probably not a question directly to a java application, but more general:
How can I access a port on the host system from inside a docker container?
 
    