docker
docker copied to clipboard
/mnt/extra-addons folder does not work correctly
Hi guys,
i'm new here in odoo
and i'm testing it in docker.
I have that problem right know, i two versions:
If volumes is - ./rotafilo/addons:/mnt/extra-addons
, inside the container i get
odoo@b09e0d9b0a6a:/$ ls mnt/extra-addons/
odoo@b09e0d9b0a6a:/$
If volumes is - ./rotafilo/addons:/var/lib/odoo/addons/11.0
, inside the container i get
odoo@b09e0d9b0a6a:/$ ls /var/lib/odoo/addons/11.0
odooplm-11.0 theme_extensia
odoo@b09e0d9b0a6a:/$ ls /var/lib/odoo/addons/11.0/theme_extensia/
ls: cannot open directory '/var/lib/odoo/addons/11.0/theme_extensia/': Permission denied
I fixed the second one problem giving the properly permissions, but still if i did it i'm not getting the addons in the default confuguration, it means, in /mnt/extra-addons
.
Why?
I'm having a similar issue, trying to install https://apps.odoo.com/apps/modules/10.0/sale_rental/ on an odoo:10 instance. I set -v ~/addons:/mnt/extra-addons
and I'm seeing the files inside the container but I don't see any new apps in odoo. Is there something else I need to do, like ensure permissions or something?
edit: nevermind, I got it to work. I didn't properly unpack the addons. Then I set
find ~/addons -type f -exec chmod 644 {} \;
find ~/addons -type d -exec chmod 755 {} \;
chmod -R root:root ~/addons
Hello guys,
are you using mac? If so then you need either:
-
to configure the file sharing of docker https://docs.docker.com/docker-for-mac/osxfs/#namespaces
-
to use directories inside one of these folders /Users , /Volumes, /private or /tmp
hope it helps
I'm using Linux: Arch Linux
.
@aelmanaa
I'm using this as the volume in compose file: /rotafilo/addons:/mnt/extra-addons
I had the same problem. I'm using Linux.
Have you tried to use "absolute path" instead of "relative path"? I have no problems like that but I'm using absolute path.
@SalahAdDin first, use ls -la for details. Seems like mounted directory /var/lib/odoo/addons/11.0/theme_extensia/ has root permissions, and user "odoo" can not access it.
As temporary workaround, set user to root in docker-compose.yml file, but that is security risk.
Example:
odoo:
image: odoo:10.0
user: root
env_file: .env
Don't do this in production mode. Normally, such problem can be fixed using same user UID, GUID on the host and container machine.
you should not use bind mounts, but use named volumes, then the permission will be ok
see docker-compose examples in the end of this page
In fact I'm having the same problem. I've inspected the mounted image and I see:
"HostConfig": {
"Binds": [
"08bda73663675dbe7c6669d9a0e8a274244aa367f148831a4ce4e0f871273775:/var/lib/odoo:rw",
"89d2aa93f45c24f7bcab13362e1894fdc17dc0acea09803db1ff3941a4bfce72:/mnt/extra-addons:rw"
],
and also
"Mounts": [
{
"Type": "volume",
"Name": "89d2aa93f45c24f7bcab13362e1894fdc17dc0acea09803db1ff3941a4bfce72",
"Source": "/var/lib/docker/volumes/89d2aa93f45c24f7bcab13362e1894fdc17dc0acea09803db1ff3941a4bfce72/_data",
"Destination": "/mnt/extra-addons",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
},
{
"Type": "volume",
"Name": "08bda73663675dbe7c6669d9a0e8a274244aa367f148831a4ce4e0f871273775",
"Source": "/var/lib/docker/volumes/08bda73663675dbe7c6669d9a0e8a274244aa367f148831a4ce4e0f871273775/_data",
"Destination": "/var/lib/odoo",
"Driver": "local",
"Mode": "rw",
"RW": true,
"Propagation": ""
}
],
Which is kind of strange as https://github.com/odoo/docker/blob/master/10.0/Dockerfile#L46 says it should be mapped to /var/lib/odoo
, which does not exist in host machine:
~$ ls -la /var/lib/odoo
ls: cannot access '/var/lib/odoo': No such file or directory
my docker compose is like this:
version: '2'
services:
web:
image: odoo:10.0
depends_on:
- db
ports:
- "8071:8069"
volumes:
- /var/www/odoo-common/addons:/mnt/extra-addons
db:
image: postgres:9.4
ports:
- "5433:5432"
environment:
- POSTGRES_PASSWORD=xxx
- POSTGRES_USER=xxx
The result is that if I get inside the docker machine:
~$ sudo touch /var/lib/docker/volumes/89d2aa93f45c24f7bcab13362e1894fdc17dc0acea09803db1ff3941a4bfce72/_data/whatever
~$ docker exec -u0 -it odoo_web_1 bash
root@a8e7e369c6fc:/# ls -la /mnt/extra-addons
total 8
drwxr-xr-x 2 odoo root 4096 Nov 29 16:05 .
drwxr-xr-x 1 root root 4096 Aug 9 02:24 ..
-rw-r--r-- 1 root root 0 Nov 29 16:05 whatever
Then I see that the volume is being mapped at /var/lib/docker/volumes/89d2aa93f45c24f7bcab13362e1894fdc17dc0acea09803db1ff3941a4bfce72/_data
Is it possible to undo the mapping without reinstalling whole container?
Ok, I don't understand why docker created this named volume when I specified path volume in docker-compose.yml
The only way I could achieve the purpose is:
~$ sudo rm -rf /var/lib/docker/volumes/89d2aa93f45c24f7bcab13362e1894fdc17dc0acea09803db1ff3941a4bfce72/_data
~$ sudo ln -s /var/www/odoo-common/addons /var/lib/docker/volumes/89d2aa93f45c24f7bcab13362e1894fdc17dc0acea09803db1ff3941a4bfce72/_data
I'm testing the 10
image and I'm getting the same problem again:
If you can see in the next lines, all addons in the folder has proper permissions:
docker exec -it paisa_web_1 /bin/bash ✔ 6556 15:49:39
odoo@eb8b8cd8d3fc:/$ ls /mnt/extra-addons
LICENSE.md medical_agpl medical_disease medical_medicament medical_medication_us medical_pathology_import medical_practitioner medical_prescription_sale medical_procedure
README.md medical_base_us medical_insurance medical_medicament_attributes medical_pathology medical_pharmacy medical_practitioner_us medical_prescription_state oca_dependencies.txt
medical medical_center medical_insurance_us medical_medication medical_pathology_icd10 medical_pharmacy_us medical_prescription medical_prescription_thread setup
odoo@eb8b8cd8d3fc:/$ ls -la /mnt/extra-addons
total 168
drwxr-xr-x 27 1000 users 4096 Dec 4 08:07 .
drwxr-xr-x 1 root root 4096 Nov 27 01:12 ..
-rw-r--r-- 1 1000 users 357 Dec 4 08:07 .coveragerc
drwxr-xr-x 8 1000 users 4096 Dec 4 08:07 .git
-rw-r--r-- 1 1000 users 555 Dec 4 08:07 .gitignore
-rw-r--r-- 1 1000 users 1059 Dec 4 08:07 .travis.yml
-rw-r--r-- 1 1000 users 35110 Dec 4 08:07 LICENSE.md
-rw-r--r-- 1 1000 users 5193 Dec 4 08:07 README.md
drwxr-xr-x 11 1000 users 4096 Dec 4 08:07 medical
drwxr-xr-x 3 1000 users 4096 Dec 4 08:07 medical_agpl
drwxr-xr-x 7 1000 users 4096 Dec 4 08:07 medical_base_us
drwxr-xr-x 9 1000 users 4096 Dec 4 08:07 medical_center
drwxr-xr-x 6 1000 users 4096 Dec 4 08:07 medical_disease
drwxr-xr-x 8 1000 users 4096 Dec 4 08:07 medical_insurance
drwxr-xr-x 5 1000 users 4096 Dec 4 08:07 medical_insurance_us
drwxr-xr-x 7 1000 users 4096 Dec 4 08:07 medical_medicament
drwxr-xr-x 5 1000 users 4096 Dec 4 08:07 medical_medicament_attributes
drwxr-xr-x 7 1000 users 4096 Dec 4 08:07 medical_medication
drwxr-xr-x 4 1000 users 4096 Dec 4 08:07 medical_medication_us
drwxr-xr-x 10 1000 users 4096 Dec 4 08:07 medical_pathology
drwxr-xr-x 6 1000 users 4096 Dec 4 08:07 medical_pathology_icd10
drwxr-xr-x 6 1000 users 4096 Dec 4 08:07 medical_pathology_import
drwxr-xr-x 5 1000 users 4096 Dec 4 08:07 medical_pharmacy
drwxr-xr-x 3 1000 users 4096 Dec 4 08:07 medical_pharmacy_us
drwxr-xr-x 9 1000 users 4096 Dec 4 08:07 medical_practitioner
drwxr-xr-x 8 1000 users 4096 Dec 4 08:07 medical_practitioner_us
drwxr-xr-x 6 1000 users 4096 Dec 4 08:07 medical_prescription
drwxr-xr-x 5 1000 users 4096 Dec 4 08:07 medical_prescription_sale
drwxr-xr-x 5 1000 users 4096 Dec 4 08:07 medical_prescription_state
drwxr-xr-x 4 1000 users 4096 Dec 4 08:07 medical_prescription_thread
drwxr-xr-x 7 1000 users 4096 Dec 4 08:07 medical_procedure
-rw-r--r-- 1 1000 users 29 Dec 4 08:07 oca_dependencies.txt
drwxr-xr-x 14 1000 users 4096 Dec 4 08:07 setup
I solved it this time with:
version: '2'
services:
web:
image: odoo:10.0
depends_on:
- db
ports:
- "8069:8069"
volumes:
- odoo-web-data:/var/lib/odoo
- ./config:/etc/odoo
- ./addons:/var/lib/odoo/.local/share/Odoo/addons/10.0
Why? Because I saw in the web
container's logs the next lines:
web_1 | 2018-12-05 05:43:37,281 1 INFO ? odoo: Odoo version 10.0-20181126
web_1 | 2018-12-05 05:43:37,281 1 INFO ? odoo: addons paths: ['/var/lib/odoo/.local/share/Odoo/addons/10.0', u'/usr/lib/python2.7/dist-packages/odoo/addons']
web_1 | 2018-12-05 05:43:37,281 1 INFO ? odoo: database: odoo@db:5432
web_1 | 2018-12-05 05:43:37,733 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on a9f8119fba88:8069
web_1 | 2018-12-05 05:44:10,063 1 INFO ? odoo.addons.report.models.report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
web_1 | 2018-12-05 05:44:20,046 1 INFO ? odoo.http: HTTP Configuring static files
web_1 | 2018-12-05 05:44:21,606 1 INFO odoo odoo.modules.loading: loading 1 modules...
web_1 | 2018-12-05 05:44:21,629 1 INFO odoo odoo.modules.loading: 1 modules loaded in 0.02s, 0 queries
web_1 | 2018-12-05 05:44:22,175 1 INFO odoo odoo.modules.loading: loading 25 modules...
So, what's the problem? I cannot understand it.
The problem is caused by the volume
./config:/etc/odoo
in my case this configuration did not allow the odoo.conf to be created in the container
i solved when i create a odoo.conf inside the config folder with the configuration
[options]
addons_path = /mnt/extra-addons
data_dir = /var/lib/odoo
Thanks rauleb!!!
Very helpful @rauleb, thanks you very much
thanks again @rauleburro , very helpful
@SalahAdDin Is this still an issue for you? Can you close this issue if not needed?
@SalahAdDin Is this still an issue for you? Can you close this issue if not needed?
I am not working on Odoo anymore, so I cannot check it.
Sorry.