odoo / docker

Other
932 stars 1.52k forks source link

AttributeError: module 'odoo' has no attribute 'cli' when using docker-compose volumes #379

Open DanielLagin opened 2 years ago

DanielLagin commented 2 years ago

Hi,

I am using docker-compose:

services:
  web:
    platform: linux/x86_64
    restart: always
    image: odoo:13.0
    #command: -d dev
    depends_on:
      - db
    ports:
      - "8069:8069"
      - "8072:8072"
    volumes:
      - odoo-web-data:/var/lib/odoo
      #- ./odoo:/usr/lib/python3/dist-packages/odoo
      - ./addons:/mnt/extra-addons
      - ./addons/_lib:/mnt/_lib
      - ./config:/etc/odoo
      - ./backups:/var/tmp
      - ./debug:/usr/lib/python3.5/debug
  db:
    restart: always
    image: postgres:10
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=odoo
      - POSTGRES_USER=odoo
      - PGDATA=/var/lib/postgresql/data/pgdata
    volumes:
      - odoo-db-data:/var/lib/postgresql/data/pgdata

Everything works fine, unless I want to map into volumes /usr/lib/python3/dist-packages/odoo:

volumes:
  - ./odoo:/usr/lib/python3/dist-packages/odoo

Output from docker-compose up:

Traceback (most recent call last):

File "/usr/bin/odoo", line 8, in <module>

odoo.cli.main()

AttributeError: module 'odoo' has no attribute 'cli'

My idea is to control odoo version without creating my own image with dockerfile and changing argument ODOO_RELEASE.

Am I doing something wrong?

Thanks.

netfxtech commented 2 years ago

It’s because you’re attempting to use the files downloaded from GitHub. You cannot map to - ./odoo:/usr/lib/python3/dist-packages/odoo without changing your entrypoint

let me know what happens when you add this to your docker-compose

command: /usr/lib/python3/dist-packages/odoo/odoo-bin -c /etc/odoo/odoo.conf

When you’re using git repo code you’ll need to use the commandline options since the entrypoint that comes from odoo:latest(or any version) is not using odoo-bin