Skip to content
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

Odoo 11 - docker container cannot find the odoo.conf file when user tries to access application URL #181

Open
ArturBumbu opened this issue Mar 22, 2018 · 10 comments

Comments

@ArturBumbu
Copy link

The logs from docker container are below:

grep: /etc/odoo/odoo.conf: No such file or directory
grep: /etc/odoo/odoo.conf: No such file or directory
grep: /etc/odoo/odoo.conf: No such file or directory
grep: /etc/odoo/odoo.conf: No such file or directory
2018-03-22 22:36:04,827 1 INFO ? odoo: Odoo version 11.0-20180122
2018-03-22 22:36:04,827 1 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons']
2018-03-22 22:36:04,827 1 INFO ? odoo: database: odoo@db:5432
2018-03-22 22:36:04,836 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
2018-03-22 22:36:04,920 1 INFO ? odoo.addons.base.ir.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
2018-03-22 22:37:12,335 1 INFO ? odoo.http: HTTP Configuring static files

@sensorii
Copy link

sensorii commented Apr 2, 2018

I've encountered what looks like a similar issue and it appears to involve permissions of docker volume directories on the host. Without doing anything special, containerized odoo user doesn't have access to write to my volume directories and install will fail with similar log message, files do not get created in my web:/var/lib/odoo volume and nginx-proxy will serve up "502 Bad Gateway".

Other docker images, like postgres for example, set permissions of volume directories properly from within the container at initial runtime -- maybe because the entrypoint script launches as root so that directory/file permissions can be changed before switching to executing as a non-root user.

Here's what I use to navigate and automate this, and also create the initial odoo config file by copying it from the odoo docker image. Before launching odoo initially (I'm using docker-compose with odoo & postgres), run this to create volume directories on the host server with permissions of the containerized odoo user:

DATA_DIR=/srv/odoo.mydomain.com
IMAGE_ODOO=odoo:11
# create volume directories with permissions of the odoo user within the container
# copy initial config file from the docker image
mkdir -p ${DATA_DIR}
chmod 777 ${DATA_DIR}
docker run -it --rm \ 
    -v ${DATA_DIR}:/x \
    --entrypoint /bin/bash \
    ${IMAGE_ODOO} \
    -c 'cp -a /etc/odoo /x/config; cp -a /var/lib/odoo /x/web; cp -a /mnt/extra-addons /x/addons'
chmod 755 ${DATA_DIR}

my odoo volumes in docker-compose.yml:

    volumes:
      - ${DATA_DIR}/addons:/mnt/extra-addons
      - ${DATA_DIR}/config:/etc/odoo
      - ${DATA_DIR}/web:/var/lib/odoo

@weeger
Copy link

weeger commented Apr 30, 2018

Hi @sensorii

Thanks for this solution but don't you have to synchronize your data folder again later if you want to have your data realy persistent ?

What the usage of /var/lib/odoo folder ?

@sensorii
Copy link

@weeger, this could have changed or been fixed by now. At the time, /var/lib/odoo was the default value for data_dir in odoo.conf. With this solution, all data is persistent and exported with volumes. The initial docker run (which looks like a lot) is only initializing some volume directories on the host using the correct permissions of the user that runs in the odoo container as well as getting the default/initial odoo.conf from the docker image (vs having to otherwise manually get it onto the host). After running that, docker-compose then runs the odoo container(s) detached in background.

@kissgyorgy
Copy link

Not fixed. When mounting volumes with docker run -v incorrect permissions are set on the host for /var/lib/odoo and the container just stuck.

@lathama
Copy link

lathama commented Mar 31, 2024

@ArturBumbu is this still an issue in 2024? Can you close if not needed?

@jhoule8091
Copy link

I am still encountering this issue however my instance is using odoo17 not odoo11 so I am not sure if that makes this applicable to or not.

@lathama
Copy link

lathama commented Apr 27, 2024

Can anyone share methods of reproducing this? Docker commands, Docker compose files?

  • Exact command ran
  • listing of perms of volumes on host system
  • listing of perms of files/dir in container

Can someone show that their odoo.conf is not readable. Here is a fast test I did

lathama@42:~$ docker run -it --entrypoint /bin/bash -v ~/tmp/odoo:/etc/odoo odoo:17
odoo@714ba77fce77:/$ ls -lha /etc/odoo/odoo.conf 
-rw-r--r-- 1 1000 1000 1.1K Apr 27 19:30 /etc/odoo/odoo.conf
odoo@714ba77fce77:/$ exit
exit
lathama@42:~$ docker run -it --entrypoint /bin/bash odoo:17
odoo@8b6089c664c7:/$ ls -lha /etc/odoo/odoo.conf 
-rw-rw-r-- 1 odoo root 816 Apr 16 21:51 /etc/odoo/odoo.conf
odoo@8b6089c664c7:/$ exit
exit
lathama@42:~$ 

@aitmlouk
Copy link

aitmlouk commented May 3, 2024

ubuntu@vm2:/tmp$ sudo docker run -it --entrypoint /bin/bash -v ~/tmp/odoo:/etc/odoo odoo:17.0
2df6d8509179:/$ ls -lha /etc/odoo/odoo.conf
ls: cannot access '/etc/odoo/odoo.conf': No such file or directory
2df6d8509179:/$

@amh-mw
Copy link

amh-mw commented May 3, 2024

@aitmlouk Would you kindly docker pull odoo:17.0 and see if you are able to reproduce with latest?

On a related note, why are you using sudo to run docker? That absolutely smells like the sort of thing that could result in file access issues.

@RemmyLee
Copy link

@aitmlouk Would you kindly docker pull odoo:17.0 and see if you are able to reproduce with latest?

On a related note, why are you using sudo to run docker? That absolutely smells like the sort of thing that could result in file access issues.

Becuase they're probably not a member of the docker group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants