Skip to Content
Menu
This question has been flagged
1 Odpoveď
770 Zobrazenia

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
Zrušiť
Autor

Are on the same Network

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


Best Answer

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
Zrušiť
Related Posts Replies Zobrazenia Aktivita
6
jan 24
15406
0
jún 23
6159
4
nov 20
5022
0
mar 17
3774
1
aug 16
5002