I have created a docker container. This database container is run successfully. I can connect to this container and see all details of database. Here is some configuration:
services:
db:
container_name: db
image: postgres:latest
ports:
- "5432:5432"
environment:
POSTGRES_USER: abc
POSTGRES_PASSWORD: abc
POSTGRES_DB: database_dev
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- postres_volume:/var/lib/postgresql/data/
Here is information I inspect from this running container:
"NetworkSettings": {
"Bridge": "",
"Ports": {
"5432/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "5432"
}
]
},
"Networks": {
"medusa_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"74f7f48596e3",
"db"
],
"NetworkID": "d48bbf5453a7c42facda69a8c2c741a20bc18d35238854c00f068bd19119afc4",
"EndpointID": "5587658ae084eba71e65fb4712bc75a0ea7c240b600d77d4b4722f5a91818d73",
"Gateway": "172.19.0.1",
"IPAddress": "172.19.0.5",
"IPPrefixLen": 16,
"IPv6Gateway": "",
}
}
Based on those information, I try some postgres clients such as PgAdmin4 or Adminer and using those information:
host: 172.19.0.5 (get from inspect)
port: 5432 (get from inspect)
user name: abc (get from docker-compose config)
password: abc (get from docker-compose config)
database name: abc_dev (get from docker-compose config)
But all clients cannot connect. I don't know what is it wrong here ? Please tell me.