跳至内容
菜单
此问题已终结
1 回复
789 查看

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.

形象
丢弃
编写者

Are on the same Network

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


最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
6
1月 24
15415
0
6月 23
6165
4
11月 20
5025
0
3月 17
3780
1
8月 16
5010