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.