@rimelek I tried to bind servers.json
from host into my docker container but it seems something is preventing that from happening. I even tried to change its ownership thinking that might be the culprit like this sudo chown -R 5050:5050 servers.json
but that did not work either. Here is what I did:
compose.yml
:
services:
postgres:
image: postgres:17.0-alpine3.20
restart: always
ports:
- "${POSTGRESQL_EXPOSED_PORT}:5432"
volumes:
- /data/postgres:/data/postgres
env_file:
- .env
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 5s
timeout: 5s
retries: 5
pgAdmin:
image: dpage/pgadmin4:8.1
restart: always
depends_on:
postgres:
condition: service_healthy
environment:
PGADMIN_DEFAULT_EMAIL: admin@admin.com
PGADMIN_DEFAULT_PASSWORD: admin
ports:
- "${PGADMIN_EXPOSED_PORT}:80"
volumes:
- ./servers.json:/tmp/servers.json
.env
PGADMIN_EXPOSED_PORT=5050
POSTGRESQL_EXPOSED_PORT=5432
PGUSER=username
POSTGRES_DB=db-name
POSTGRES_USER=username
POSTGRES_PASSWORD=change-me
COMPOSE_PROJECT_NAME=postgre_pgadmin
PGDATA=/var/lib/postgresql/data/pgdata
servers.json
{
"Servers": {
"1": {
"Name": "postgres",
"Group": "GroupName",
"Port": 5432,
"Username": "username",
"Host": "localhost",
"SSLMode": "prefer",
"MaintenanceDB": "db-name",
"BGColor": "#1f1f1f",
"FGColor": "#000000",
"Comment": "This server will connect to the instance we've created in our compose file."
}
}
}
Can you see anything wrong with this setup? Personally failed to diagnose it so I just for now decided to go with something like this: docker/docker-compose-files/postgres/postgres-pgadmin/compose.yml at main · kasir-barati/docker · GitHub
BTW if my repo was helpful consider giving it a star