docker-compose.yml
version: '3.8'
services:
db:
image: postgres
restart: always
container_name: security-db
environment:
POSTGRES_DB: security-db
POSTGRES_USER: scrty
POSTGRES_PASSWORD: scrty123
ports:
- '5050:5432'
application.properties
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.datasource.url=jdbc:postgresql://localhost:5050/security-db
spring.datasource.username=scrty
spring.datasource.password=scrty123
spring.jpa.hibernate.ddl-auto=update
I am trying to run my Spring Boot application inside a Docker container and I am also running a PostgreSQL database in another Docker container. However, my application cannot establish a connection with the PostgreSQL database.
New contributor
sezer demir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.