I have docker 26.1.3 on Ubuntu 24.04 LTS and run two apps with different compose files / stacks.
Both use a postgresql database, none of them is exposed to the host. They are on different containers and virtual hosts, the volumes for the db files are persistent and separated - so in theory there should be no interference.
I can, however, reproduce authentification errors on both services (password authentication failed for user XXX) that only happen when both psql containers are up, but even then the error is not always happening - meaning when both are up several store and retrieve commands work and then the authentification might occur.
It’s like under some circumstances one tries to connect to the other database.
Yep, they don’t share any state. The details you shared, indeed indicate this is not the problem. Thus said, the problem must be in parts of your setup that you didn’t share.
Educated guess:
Both database service have the same name and are attached to a shared container network
The client application that experiences the problem access the database by service name and is also attached to the same shared container network
If this is the case then this is a dns issue, as the client can not differentiate which database service you mean to access.
You can either introduce a network alias for each database service, and call the service by the alias:
You can call the database service by {service}.{network} to make sure the ip is resolved in a specific network.
Before asking any questions about this: we need way more information to get a real idea about what’s going on
Hello,
It seems like your PostgreSQL containers are experiencing cross-container authentication issues. To resolve this, ensure each PostgreSQL container is on a separate Docker Jetnet American Airlines network, give each container a unique name, and double-check that environment variables and connection strings are correct and not conflicting.