I have bare-metal PostgreSQL server with ip = 192.168.33.12 that i want to use with Odoo.
And I want to run Odoo in Docker and have some kind of persistence.
So, I wan to connect dockered Odoo with my PostgreSQL server.
Here is my docker-compose.yml
version: '3.1'
services:
web:
image: odoo:15.0
ports:
- "8069:8069"
volumes:
- odoo-web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/mnt/extra-addons
volumes:
odoo-web-data:
On Docker server I have created several directories:
~/odoo/config
~/odoo/addons
docker-compose.yml is in ~/odoo/.
Refers to this guide odoo – Official Image i got odoo.conf in "~/odoo/config" that contains this:
[options]
addons_path = /mnt/extra-addons
data_dir = /var/lib/odoo
admin_passwd = such_a_strong_password
db_host = 192.168.33.12
db_port = 5432
db_user = odooadmin
db_password = one_more_pass
dbfilter = ^odoo-docker-host-0.*$
db_maxconn = 64
So, after running
docker-compose up -d
I can see in Docker logs this entry:
Database connection failure: could not translate host name "db" to address: Name or service not known
2
Answers
I found the solution!
My config is ok. The problem was in PostgreSQL server network configuration.
We need tu put this in postgresql.conf:
And in pg_hba.conf:
or better
Now everything works fine.
well, your docker-compose file is missing the db configurations an example an example could be there. in your case your file could go as following: