I have a spring application which connects to a local database. The application works perfectly. When I try making a docker container, I get connection refused error and it won't connect to the database anymore. This is the application.properties file:
server.port = 8010
# create and drop tables and sequences, loads import.sql
spring.jpa.hibernate.ddl-auto=
spring.datasource.url= jdbc:oracle:thin:@localhost:1521/xe
spring.datasource.username=STUDENT
spring.datasource.password=STUDENT
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
#hibernate config
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
This is how I run the docker container:
docker run correctanadressserver:0.0.1-SNAPSHOT
The application starts and works, but it can't connect to the database.