I'm running a multi-container in Docker Desktop where one of the containers holds a PostgreSQL database. When I print the data in the terminal it's rather difficult to read well since its not formatted well. My solution was to connect to the database using a 3rd party application, in this case DBeaver, however when I try to connect I get the following error:
FATAL: password authentication failed for user "rasa"
I have made sure that the port, database name, username & password are correct (they match the ones in the docker-compose file & I can connect in the Docker terminal). However I continue to get this error.
These are the connection settings I'm using in DBeaver:
Checking the logs this is all I get in DBeaver:
With this as the Exception Stack Trace:
org.postgresql.util.PSQLException: FATAL: password authentication failed for user "rasa"
at org.postgresql.Driver$ConnectThread.getResult(Driver.java:397)
at org.postgresql.Driver.connect(Driver.java:305)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCConnectionOpener.run(JDBCConnectionOpener.java:109)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCConnectionOpener.run(JDBCConnectionOpener.java:83)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:214)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.openConnection(JDBCDataSource.java:133)
at org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource.openConnection(PostgreDataSource.java:558)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCExecutionContext.connect(JDBCExecutionContext.java:124)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCRemoteInstance.initializeMainContext(JDBCRemoteInstance.java:106)
at org.jkiss.dbeaver.ext.postgresql.model.PostgreDatabase.checkInstanceConnection(PostgreDatabase.java:235)
at org.jkiss.dbeaver.ext.postgresql.model.PostgreDatabase.<init>(PostgreDatabase.java:122)
at org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource.createDatabaseImpl(PostgreDataSource.java:272)
at org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource.initializeRemoteInstance(PostgreDataSource.java:166)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.<init>(JDBCDataSource.java:109)
at org.jkiss.dbeaver.model.impl.jdbc.JDBCDataSource.<init>(JDBCDataSource.java:100)
at org.jkiss.dbeaver.ext.postgresql.model.PostgreDataSource.<init>(PostgreDataSource.java:106)
at org.jkiss.dbeaver.ext.postgresql.PostgreDataSourceProvider.openDataSource(PostgreDataSourceProvider.java:115)
at org.jkiss.dbeaver.registry.DataSourceDescriptor.openDataSource(DataSourceDescriptor.java:1417)
at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect0(DataSourceDescriptor.java:1280)
at org.jkiss.dbeaver.registry.DataSourceDescriptor.connect(DataSourceDescriptor.java:1070)
at org.jkiss.dbeaver.runtime.jobs.ConnectJob.run(ConnectJob.java:78)
at org.jkiss.dbeaver.runtime.jobs.ConnectionTestJob.run(ConnectionTestJob.java:102)
at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:119)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Within the Docker container for postgresql I also turned on log_connections, however whenever I test the connection nothing is added to the log. I am sure turning it on did work as I do get this output:
LOG: parameter "log_connections" changed to "on"
DBeaver is running on my Windows 11 Home laptop, not in Docker or anything like that.
This is my docker-compose.yml file:
services:
postgres:
image: postgres
container_name: rasa-postgres
restart: always
environment:
POSTGRES_USER: rasa
POSTGRES_PASSWORD: PASSWORD
POSTGRES_DB: rasa_db
ports:
- "5432:5432"
rasa:
build: ./rasa_chatbot
container_name: rasa-server
depends_on:
- postgres
ports:
- "5005:5005"
volumes:
- ./rasa_chatbot:/app
environment:
DB_HOST: rasa-postgres # Match container name of postgres service
DB_PORT: 5432
DB_USER: rasa
DB_PASSWORD: PASSWORD
DB_NAME: rasa_db
user: "0:0"
frontend:
build: ./vue-app
container_name: vue-app
ports:
- "4173:4173" # Same as Vite
depends_on:
- rasa
And here is my container info:
{
"Id": "ID",
"Created": "2025-02-13T08:32:24.596577167Z",
"Path": "docker-entrypoint.sh",
"Args": [
"postgres"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 4699,
"ExitCode": 0,
"Error": "",
"StartedAt": "2025-02-13T08:32:25.047098609Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:IMAGE",
"ResolvConfPath": "/var/lib/docker/containers/b2f3b2226c2f64786bbd8fae77eeea6eb957d596fe9401aec53e9a2c8335e774/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/b2f3b2226c2f64786bbd8fae77eeea6eb957d596fe9401aec53e9a2c8335e774/hostname",
"HostsPath": "/var/lib/docker/containers/b2f3b2226c2f64786bbd8fae77eeea6eb957d596fe9401aec53e9a2c8335e774/hosts",
"LogPath": "/var/lib/docker/containers/b2f3b2226c2f64786bbd8fae77eeea6eb957d596fe9401aec53e9a2c8335e774/b2f3b2226c2f64786bbd8fae77eeea6eb957d596fe9401aec53e9a2c8335e774-json.log",
"Name": "/rasa-postgres",
"RestartCount": 0,
"Driver": "overlayfs",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": [
"a31f25eefe8c7f19bcb15bc9e11ab24d584180c10eb1ed41e9923188fe667a6b"
],
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "chatbot_default",
"PortBindings": {
"5432/tcp": [
{
"HostIp": "",
"HostPort": "5432"
}
]
},
"RestartPolicy": {
"Name": "always",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"ConsoleSize": [
0,
0
],
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "host",
"Dns": null,
"DnsOptions": null,
"DnsSearch": null,
"ExtraHosts": [],
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"DeviceCgroupRules": null,
"DeviceRequests": null,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware",
"/sys/devices/virtual/powercap"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": null,
"Name": "overlayfs"
},
"Mounts": [
{
"Type": "volume",
"Name": "1491f2cf7ea7da08a0ac23f6038207cfa9c19e12a1408cdd073abdb239e57fd8",
"Source": "/var/lib/docker/volumes/ID/_data",
"Destination": "/var/lib/postgresql/data",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
"Config": {
"Hostname": "b2f3b2226c2f",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"ExposedPorts": {
"5432/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"POSTGRES_USER=rasa",
"POSTGRES_PASSWORD=PASSWORD",
"POSTGRES_DB=rasa_db",
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/17/bin",
"GOSU_VERSION=1.17",
"LANG=en_US.utf8",
"PG_MAJOR=17",
"PG_VERSION=17.2-1.pgdg120+1",
"PGDATA=/var/lib/postgresql/data"
],
"Cmd": [
"postgres"
],
"Image": "postgres",
"Volumes": {
"/var/lib/postgresql/data": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "daac92a1cd446777f5647ce044ba91173b61a6e8af34dc83b64efe9c86cb1e70",
"com.docker.compose.container-number": "1",
"com.docker.compose.depends_on": "",
"com.docker.compose.image": "sha256:87ec5e0a167dc7d4831729f9e1d2ee7b8597dcc49ccd9e43cc5f89e808d2adae",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "chatbot",
"com.docker.compose.project.config_files": "C:\\Users\\jespe\\Documents\\GitHub\\chatbot\\docker-compose.yml",
"com.docker.compose.project.working_dir": "C:\\Users\\jespe\\Documents\\GitHub\\chatbot",
"com.docker.compose.service": "postgres",
"com.docker.compose.version": "2.32.4"
},
"StopSignal": "SIGINT"
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "08d4744080720f49c9200011a335cf25a11eab2eb591a3423670ccf6d0fad722",
"SandboxKey": "/var/run/docker/netns/08d474408072",
"Ports": {
"5432/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "5432"
}
]
},
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"chatbot_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"rasa-postgres",
"postgres"
],
"MacAddress": "02:42:ac:12:00:02",
"DriverOpts": null,
"NetworkID": "9ba44443812e233e8e909cce6a83b247717949e0ebc5f6a0067d5278d526c4d0",
"EndpointID": "91697c3e49e541c9fbcd46c46d510cc9968c82ffca593efe318be0ee223467d0",
"Gateway": "[internal Docker IP]",
"IPAddress": "[internal Docker IP]",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"DNSNames": [
"rasa-postgres",
"postgres",
"b2f3b2226c2f"
]
}
}
}
}
I am willing to use a different application than DBeaver, I just want to be able to view my tables in a way where it does not look like a puzzle.
I have tried the following:
Change 'trust' to 'md5' in pg_hba.conf
I tried to change to change to auhentication method from trust
to md5
, however the issue persists. I've also made sure the change did work, after running
cat /var/lib/postgresql/data/pg_hba.conf | grep "host"
I got the following:
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5
host all all all scram-sha-256
Reset user password
I've reset the password for the user, just in case, however this also did not solve the issue.
Rebuild containers
Just in case I reset everything by running
docker-compose down -v
And then
docker-compose up --build
However, this too did not solve the problem.
Connect using CMD outside of Docker Desktop
To make sure I couldn't only connect within docker I used the Windows command prompt to connect, this worked, however if I request the table here it's still formatted horribly.
Checked user permissions
I used \dt to show all user-defined tables, I got the following:
List of roles
Role name | Attributes
-----------+------------------------------------------------------------
rasa | Superuser, Create role, Create DB, Replication, Bypass RLS
Connect using another application
To make sure the problem wasn't with DBeaver I used pgcli which I installed using pip, then I tried to access the database here and I got the same error.
It's solved. I ran netstat -aon
and it showed me 2 processes on the same port, which was also the port I was using for postgres (Like someone suggested). I killed one of these tasks and rebuilt the Docker container, then tried connecting again. It worked this time. Thank you all.