Have some simple docker-compose.yml file configuration, but I am not sure why I can't not login to pgAdmin using [email protected] as email and admin as a password. Does it need more configuration or am I using wrong credentials?
version: "3.7"
services:
db:
image: postgres:13.1
restart: unless-stopped
env_file:
- ./.env
ports:
- 5432:5432
volumes:
- db-data:/var/lib/postgresql/data
- ./init-db.sh:/docker-entrypoint-initdb.d/init-database.sh
networks:
- appNetwork
pgAdmin:
container_name: pgAdmin
# restart: unless-stopped
image: dpage/pgadmin4:4.29
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:[email protected]}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
PGADMIN_LISTEN_PORT: 5050
volumes:
- pgadmin:/root/.pgadmin
ports:
- "5050:5050"
depends_on:
- db
networks:
- appNetwork
volumes:
db-data:
pgadmin:
networks:
appNetwork:
driver: bridge

You define PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD and also use a persistent volume pgadmin. Maybe you previously created an instance with a different email/password which have been persisted in pgadmin volume and is not overriden by your newly defined variables.
You can try to delete stack containers and volumes with:
# WARNING: this will delete all containers and volumes
# including pg_data volume and pgadmin volume
# make sure to make a backup if needed
docker-compose down -v
Alternatively, you can just stop pgAdmin container and specifically delete the pgadmin volume:
docker-compose rm -s pgAdmin
# Replace project_name by your Docker Compose project name
# Use docker volume ls to show all volumes and choose the proper one
docker volume rm project_name_pgadmin
Then re-create pgAdmin container and volume (and if necessary other components):
docker-compose up -d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With