Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
781 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Tác giả

Are on the same Network

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


Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
6
thg 1 24
15413
0
thg 6 23
6162
4
thg 11 20
5025
0
thg 3 17
3778
1
thg 8 16
5009