This question has been flagged
2 Replies
46875 Views

I am having an issue when trying to start a docker container using docker-compose and the official compose file.

Here is my docker-compose.yml file (copied from the official Docker image https://store.docker.com/images/odoo):

version:'2'
services:
web:
image:odoo:12.0
depends_on:
  - db
ports:
  - "8069:8069"
volumes:
  - odoo12-web-data:/var/lib/odoo
  - ./addons:/mnt/extra-addons
db:
image:postgres:10
environment:
  - POSTGRES_PASSWORD=odoo
  - POSTGRES_USER=odoo
  - PGDATA=/var/lib/postgresql/data/pgdata
volumes:
  - odoo12-db-data:/var/lib/postgresql/data/pgdata
volumes:
odoo12-web-data:
odoo12-db-data:

 

Here is what I get when I docker-compose up :

db_1   | 2018-10-26 13:18:04.762 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2018-10-26 13:18:04.762 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2018-10-26 13:18:04.812 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2018-10-26 13:18:04.831 UTC [25] LOG: database system was shut down at 2018-10-26 12:12:24 UTC
db_1 | 2018-10-26 13:18:04.839 UTC [1] LOG: database system is ready to accept connections
web_1 | 2018-10-26 13:18:06,183 1 INFO ? odoo: Odoo version 12.0-20181008
web_1 | 2018-10-26 13:18:06,183 1 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf
web_1 | 2018-10-26 13:18:06,184 1 INFO ? odoo: addons paths: ['/var/lib/odoo/addons/12.0', '/mnt/extra-addons', '/usr/lib/python3/dist-packages/odoo/addons']
web_1 | 2018-10-26 13:18:06,184 1 INFO ? odoo: database: odoo@db:5432
web_1 | 2018-10-26 13:18:06,327 1 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
web_1 | 2018-10-26 13:18:06,505 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on c83179cbca11:8069

and here is the error I get when I go to localhost:8069 :

 web_1  | 2018-10-26 13:23:28,389 1 INFO odoo werkzeug: 172.20.0.1 - - [26/Oct/2018 13:23:28] "GET / HTTP/1.1" 500 - 2 0.003 0.008
web_1 | 2018-10-26 13:23:28,392 1 ERROR odoo werkzeug: Error on request:
web_1 | Traceback (most recent call last):
web_1 | File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 205, in run_wsgi
web_1 | execute(self.server.app)
web_1 | File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 193, in execute
web_1 | application_iter = app(environ, start_response)
web_1 | File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 255, in app
web_1 | return self.app(e, s)
web_1 | File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 128, in application
web_1 | return application_unproxied(environ, start_response)
web_1 | File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 117, in application_unproxied
web_1 | result = odoo.http.root(environ, start_response)
web_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 1317, in __call__
web_1 | return self.dispatch(environ, start_response)
web_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 1290, in __call__
web_1 | return self.app(environ, start_wrapped)
web_1 | File "/usr/lib/python3/dist-packages/werkzeug/wsgi.py", line 599, in __call__
web_1 | return self.app(environ, start_response)
web_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 1470, in dispatch
web_1 | ir_http = request.registry['ir.http']
web_1 | File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 176, in __getitem__
web_1 | return self.models[model_name]
web_1 | KeyError: 'ir.http' - - -
web_1 | 2018-10-26 13:23:28,451 1 INFO odoo werkzeug: 172.20.0.1 - - [26/Oct/2018 13:23:28] "GET /favicon.ico HTTP/1.1" 500 - 2 0.004 0.012
web_1 | 2018-10-26 13:23:28,455 1 ERROR odoo werkzeug: Error on request:
web_1 | Traceback (most recent call last):
web_1 | File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 205, in run_wsgi
web_1 | execute(self.server.app)
web_1 | File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 193, in execute
web_1 | application_iter = app(environ, start_response)
web_1 | File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 255, in app
web_1 | return self.app(e, s)
web_1 | File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 128, in application
web_1 | return application_unproxied(environ, start_response)
web_1 | File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 117, in application_unproxied
web_1 | result = odoo.http.root(environ, start_response)
web_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 1317, in __call__
web_1 | return self.dispatch(environ, start_response)
web_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 1290, in __call__
web_1 | return self.app(environ, start_wrapped)
web_1 | File "/usr/lib/python3/dist-packages/werkzeug/wsgi.py", line 599, in __call__
web_1 | return self.app(environ, start_response)
web_1 | File "/usr/lib/python3/dist-packages/odoo/http.py", line 1470, in dispatch
web_1 | ir_http = request.registry['ir.http']
web_1 | File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 176, in __getitem__
web_1 | return self.models[model_name]
web_1 | KeyError: 'ir.http' - - -

Then here is what I get few seconds after trying to access localhost:8069

db_1   | 2018-10-26 13:20:06.476 UTC [33] ERROR:  relation "ir_module_module" does not exist at character 28
db_1 | 2018-10-26 13:20:06.476 UTC [33] STATEMENT: SELECT latest_version FROM ir_module_module WHERE name='base'
web_1 | 2018-10-26 13:20:06,477 1 ERROR odoo odoo.sql_db: bad query: b"SELECT latest_version FROM ir_module_module WHERE name='base'"
web_1 | ERROR: relation "ir_module_module" does not exist
web_1 | LINE 1: SELECT latest_version FROM ir_module_module WHERE name='base...
web_1 | ^
web_1 |
web_1 | 2018-10-26 13:20:06,477 1 WARNING ? odoo.addons.base.models.ir_cron: Tried to poll an undefined table on database odoo.

When I try with odoo11 image and postgre 9.4 (almost same docker-compose file) it works...

What am I doing wrong ?


Avatar
Discard

seems like db init fails. did you check that whole db structure exists?

Best Answer

the problem occur when there is error about establishing database connection.

if you have many databases in Postgresql management, you should specify the one that you want to connect to

in config file add

db_name = DB_NAME_THAT_YOU_WANT_TO_CONNECT

after that you should run the ./odoo-bin -i base


Avatar
Discard
Best Answer

I would check out https://github.com/odoo/odoo/issues/27447

Adding -e POSTGRES_DB=postgres was the solution for me.

Avatar
Discard

Where? I'm using Odoo and i have this problem when i try to use a custom database. why????