I have been reading several possible solutions on StackOverflow but none of them solve my problem. Last week everything was working correctly and this week it stopped working. I don't know if it was because of the new versions of pgAdmin/Postgres having it as latest and every time it launched the containers once the previous images were deleted until everything was working and I have selected previous versions and it still doesn't work. It does not connect to the Postgres administrator using the user [email protected] defined by default, I do not even see a loggin error in the traces. I'm new to Docker + Docker-compose issues and I've followed all the examples but it hasn't worked for me again. I have deleted all the images and recreated everything from 0 and it still doesn't work. I have not changed much about the docker-compose script, I have only quoted the ports, the environment variables, I have changed the format of - VARIABLE= --> VARIABLE: but it has had no effect.
Another thing I see is that it does not create the DB with the script that is passed. Any ideas? I leave here the complete docker-compose script and the database creation script.
When I set into pgAdmin login: [email protected]/qwerty don't enter
NOTE: Postgres DB is started
Thank you
docker-compose.yml
version: '3.8'
services:
# Other services
############################################################################
## Database configuration
##
############################################################################
postgres_db:
networks:
- payment_network
container_name: postgres
image: postgres:15.6
ports:
- "3432:5432"
restart: always
volumes:
- ./dbfiles:/docker-entrypoint-initdb.d
- /var/lib/postgres_data:/var/lib/postgressql/data
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=qwerty
- POSTGRES_DB=postgres
pgadmin4:
networks:
- payment_network
image: dpage/pgadmin4:8.2
restart: always
environment:
- [email protected]
- PGADMIN_DEFAULT_PASSWORD=qwerty
ports:
- "80:80"
depends_on:
- postgres_db
networks:
payment_network:
name: payment_network
driver: bridge
Script to init DB
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER springboot WITH PASSWORD 'qwerty';
CREATE DATABASE springboot;
GRANT ALL PRIVILEGES ON DATABASE springboot TO springboot;
EOSQL
I don't know what happened but I changed the username and password and it allowed me to log in.