I am trying to create my own Spring Boot
application with a POSTGRESQL
database. I have started using docker
to mount the database, with a docker-compose
whose values are as follows:
version: "3"
services:
products-postgresql:
image: postgres:9.6
restart: always
ports:
- 5450:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: superadmin
POSTGRES_DB: products
volumes:
- D:\microservicios\workspace\SpringSecurity\volumes:/var/lib/postgresql/data:rw
With the docker-compose up -d
command, I managed to get it up easily,
The problem occurs to me when trying to connect with DBeaver
to the database. I have configured it as a new POSTGRESQL
connection, passing the connection data similar to those of docker-compose, (database
= products, host
= localhost, user
= postgres, password
= superadmin....) but it returns FATAL error: database "products" does not exist
.
I've seen similar posts, like this psql: FATAL: database "" does not exist , but they don't work for me. I have verified that I don't have any other application using the same port.
Could you tell me what I may be doing wrong, or what I have left to configure? Thanks
UPDATE: Image showing that the container lifts my database
Although I still don't understand why, I had to change the port of my container to 5432 (the one used by POSTGRESQL), and it finally worked for me.
version: "3"
services:
products-postgresql:
image: postgres:9.6
restart: always
ports:
- 5432:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: superadmin
POSTGRES_DB: products
volumes:
- D:\microservicios\workspace\SpringSecurity\volumes:/var/lib/postgresql/data:rw