This repository was created using the official Odoo Docker images as a starting point but modifying them to make them work in a Traefik environment.
You probably want to start by setting up:
Once you have them running and you already created a Postgres user that can create databases, clone this repository:
git clone https://github.com/hawara-es/odoo-for-docker.git
cd odoo-for-docker
Once you have cloned the repository, create a new .env
file and set the environment variables as you wish.
cp env.example .env
To start the container with minimum settings, just run:
docker compose up -d
You should now be able to access your Docker instance by visiting http://${ODOO_HOST}
(or https
, depending on your settings).
To open a Python shell with Odoo loaded, you can use the open-shell
command that's preinstalled in your container:
docker compose exec odoo open-shell
You can create a backup of your addons, configuration and data files by running the backup
host script. That will create 3 files in the backups/
folder:
- odoo-addons.tar.gz
- odoo-config.tar.gz
- odoo-data.tar.gz
Also, remember to backup your database.
Note
If you are using the sibling project postgresql-for-docker, check the Backup the databases section of its README file.
You can restore the backup that's in the backups/
folder by running the restore
host script. Keep in mind that this will restore your files but it won't restore your database.
Note
If you are using the sibling project postgresql-for-docker, check the Restore a backup section of its README file.
To run Odoo's tests, use the run-tests
preinstalled command in a disposable container:
docker compose run --rm odoo run-tests
As the former command would run all the available tests, you may want to limit the tests by filtering them with a tag.
docker compose run --rm odoo run-tests --test-tags faker
To run an upgrade, for instance from version 17.0 to 18.0, these are the steps.
Before running a long and complex process like an upgrade, backup your database and files. You have instructions on how to do it above in this same document.
Change the value of your ODOO_VERSION
in your .env file.
# nano .env
ODOO_VERSION=18.0
Build the updated images and check the logs to see if everything seems correct.
docker compose down
docker compose build --no-cache
docker compose up -d
If your logs end with this error message:
AssertionError: /var/lib/odoo/sessions: directory is not writable
You may want to check the permissions of the entire odoo-data folder.
# docker compose exec -u root odoo bash
chown -R odoo:odoo /var/lib/odoo
If your logs end with this error message:
ValueError: Module {some_module_name_here}: invalid manifest
You may want to upgrade the module. Check it's version
attribute in its manifest file.