odoo / docker

Other
956 stars 1.54k forks source link

odoo user doesn't have permission to read/write on /var/lib/odoo volumes #360

Closed AndersonJim closed 3 years ago

AndersonJim commented 3 years ago

Impacted images:

Running an odoo:13 container I tried to set a volume for /var/lib/odoo, the container runned well, and everything looked nice until I tried to access odoo but server didn't response.

command: docker run -p 8069:8069 --link db_10:db --rm -t -v $PWD/odoo:/etc/odoo -v $PWD/addons:/mnt/extra-addons -v $PWD/filestore:/var/lib/odoo odoo:13.0

Shell Captura de pantalla (30)

View from browser Captura de pantalla (31)

Then I realized that odoo could write/read in the -v folder I tested change /var/lib/odoo ownership and it worked.

Captura de pantalla (33)

Captura de pantalla (32)

shouldn't this be add into the Dockerfile in order to avoid this type of situation?

Like this:

# Set permissions and Mount /var/lib/odoo to allow restoring filestore and /mnt/extra-addons for users addons
RUN chown odoo /etc/odoo/odoo.conf \
    && mkdir -p /mnt/extra-addons \
    && chown -R odoo /mnt/extra-addons \
    && chown -R odoo /var/lib/odoo

VOLUME ["/var/lib/odoo", "/mnt/extra-addons"]
d-fence commented 3 years ago

Hi, I'm sorry to say that it won't change anything. In the end, the mounted directory will have the ownership of your host user. For example, if your $PWD/filestore directory is owned by a user id 1000 that have write permission in it, you will end up with the same permission and ownership in the Docker container ... where the odoo user id is 101. So odoo user won't have write permission in it.

AndersonJim commented 3 years ago

@d-fence Oh yeah, That's true Thanks for your feedback.

I'll be closing this issue.