简体   繁体   中英

Odoo container : Database connection failure: could not connect to server: Connection refused (linking odoo with localhost postgres)


I'm trying to run the odoo docker container and linking it with my local (not container) postgresql.
I tried this command (as suggest here ).

docker container run -p 8089:8069 -e HOST=127.0.0.1 -e USER=tux -e PASSWORD=tux --name odoo -t odoo

Ran it and got these errors :

Database connection failure: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Cannot assign requested address
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?

I tried to open up the port 5432 with ufw but got the same erros. I also tried to change 127.0.0.1 to 0.0.0.0 but nothing.
Could you help me?

ps : the USER and PASSWORD are corrects, I use them when I run odoo instance in my local.

you might need to add the host network with a flag --network=host

WARNING: Published ports are discarded when using host network mode that just means you cannot change the port bindings. thats as secure as your machine is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM