-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[9.0] Using odoo+postgresql in Docker Compose Uses Wrong IP Address #57
Comments
Try to add -e DB_PORT_5432_TCP_ADDR=db |
Trying same thing with no success: version: '2'
services:
db:
image: 'postgres:9.4'
restart: always
environment:
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
# volumes:
# - './pgdata:/var/lib/postgresql/data'
web:
image: 'odoo:9'
restart: always
ports:
- '8069:8069'
links:
- db:db
environment:
- DB_PORT_5432_TCP_ADDR=db
# volumes:
# - './config:/etc/odoo'
# - './addons:/mnt/extra-addons'
# - './data:/var/lib/odoo/filestore' Error:
|
The error is
|
@BigZ94 I did not get a resolution to this. I just used a regular script to start odoo instead of docker-compose. |
This is not an issue with Odoo, but rather an issue with docker-compose. Links does make an alias, e.g. if you get your docker-compose running and then The easy solution here is to either set environment variables that /entrypoint.sh is expecting on the odoo service section:
OR mount in a config file with with the db host as 'db', user 'odoo', password 'odoo'... While I have tested the former, I tend to prefer the later as I can run the DB container once with a random password (to create the data data files) and then remove those environment variables from the compose file. (noting that random password in an odoo config file that probably needs modifications like add-on directories anyway). The former is probably better for 'testing' or other extremely temporary setups. |
@jaredkipe Thanks for the explanation. |
@medined You're welcome! |
@medined Hi , I'm facing the same issue like you while trying to dockerize the Odoo13. Can you please tell me how you overcome this issue? |
@agiratech-murali I'm sorry but I haven't used odoo since 2017 and don't remember. |
I am trying to use Docker Compose to run odoo. However, the my odoo-web container is not able to connect with my odoo-db container. Here is my docker-compose.yml file:
{noformat}
version: "2"
services:
odoo-db:
restart: on-failure:10
image: postgres:9.4
volumes:
- "d13-odoo:/var/lib/postgresql"
environment:
- POSTGRES_USER=odoo
- POSTGRES_PASSWORD=odoo
odoo-web:
image: odoo:9.0
links:
- odoo-db:db
ports:
- "8069:8069"
volumes:
d13-odoo:
{noformat}
When I run 'docker-compose uo -d', the containers start. And keep running. When I try to connect to the odoo web page using http://192.168.99.100:8069, I see the following error:
{noformat}
2016-06-04 21:09:43,016 1 INFO ? werkzeug: 192.168.99.1 - - [04/Jun/2016 21:09:43] "GET / HTTP/1.1" 500 -
2016-06-04 21:09:43,022 1 ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/usr/lib/python2.7/dist-packages/openerp/service/server.py", line 246, in app
return self.app(e, s)
File "/usr/lib/python2.7/dist-packages/openerp/service/wsgi_server.py", line 184, in application
return application_unproxied(environ, start_response)
File "/usr/lib/python2.7/dist-packages/openerp/service/wsgi_server.py", line 170, in application_unproxied
result = handler(environ, start_response)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1488, in call
return self.dispatch(environ, start_response)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1462, in call
return self.app(environ, start_wrapped)
File "/usr/lib/python2.7/dist-packages/werkzeug/wsgi.py", line 588, in call
return self.app(environ, start_response)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1617, in dispatch
self.setup_db(httprequest)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1548, in setup_db
httprequest.session.db = db_monodb(httprequest)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1695, in db_monodb
dbs = db_list(True, httprequest)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1669, in db_list
dbs = openerp.service.db.list_dbs(force)
File "/usr/lib/python2.7/dist-packages/openerp/service/db.py", line 307, in list_dbs
with closing(db.cursor()) as cr:
File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 630, in cursor
return Cursor(self.pool, self.dbname, self.dsn, serialized=serialized)
File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 164, in __init
self._cnx = pool.borrow(dsn)
File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 513, in _locked
return fun(self, _args, *_kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 581, in borrow
**connection_info)
File "/usr/lib/python2.7/dist-packages/psycopg2/init.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
{noformat}
Please note that I am using Windows. This means that I have a default unix running inside VirtualBox. The IP address of the default container is 192.168.99.100. However, the IP addresses of the two odoo-related containers are 172.18.0.X.
If I use "docker exec -it odoo_odoo-web_1 /bin/bash" to connect to the running odoo-web container, I can use "psql -h db -p 5432 -U odoo -W odoo" to connect to the odoo-db instance and run SQL commands. To me, this means that odoo is pulling the IP address somehow incorrectly. Using 'ping db' inside the container does produce the correct '172.18.0.2' address.
Where is odoo getting "192.168.99.1" from? I don't know enough python to debug this problem. However, I'd be happy to work with someone to resolve this.
Thanks.
P.S. Everything works if I am not using docker-compose.
The text was updated successfully, but these errors were encountered: