Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
817 Ansichten

I have a Plesk Webspace, with Docker Extension.

I pulled the last Odoo Docker Container, and my  POSTGRES is running. 

Everytime i start my container i get 
" Database connection failure: could not translate host name "db" to address: Name or service not known"

Thats my Odoo Container Values

POSTGRES_HOSTodoo-db
POSTGRES_PASSWORDREMOVED FOR SECURITY
POSTGRES_PORT32788
POSTGRES_USERodoo


Thats my Postgres Container Values (named: odoo-db)

POSTGRES_DBodoo
POSTGRES_PASSWORDREMOVED FOR SECURITY
POSTGRES_USERodoo

The Postgress Container is always active, but the Odoo Container crashes always with the Database Error.

Avatar
Verwerfen
Autor

Are on the same Network

I setted the Port to 5432 and still running in the Same error


Beste Antwort

Hii,

Make sure both containers are on the same Docker network

  • Docker container hostnames resolve only if containers are on the same user-defined network.
  • Plesk’s Docker extension might create separate networks per container by default.
  • You need to connect both containers to the same Docker network manually.

Verify container networkdocker network ls

docker network inspect <network_name>

 Use SSH or Plesk’s Docker CLI to run:

docker network ls

docker network inspect <network_name>

Check if both containers are listed under the same network.

If not, create a user-defined network and connect both containers to it

docker network create odoo-network

docker network connect odoo-network odoo-db

docker network connect odoo-network odoo-container-name


Example:
docker network create odoo-network

docker network connect odoo-network odoo-db

docker network connect odoo-network odoo-container-name

Set POSTGRES_HOST=odoo-db in your Odoo container environment

This matches the postgres container name and will resolve now.

Also ensure the port is the internal Postgres port 5432

The POSTGRES_PORT environment variable should be 5432, the internal port, not the published port like 32788.


i hope it is usefull

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
6
Jan. 24
15448
0
Juni 23
6195
4
Nov. 20
5040
0
März 17
3784
1
Aug. 16
5021