Previously we already tried how to install Odoo on Ubuntu using the installer and using virtualenv. There is another way to run Odoo, using Docker. If you not installed docker yet, you can see this link.
You can see the official Odoo Docker image at the Docker hub. There are many versions of Odoo in the Docker hub. We will use odoo:13 for this tutorial. The default odoo:13 image use Debian Buster (ver. 10.x) and Wkhtmltopdf 0.12.5.x. See https://github.com/odoo/docker/blob/master/13.0/Dockerfile
For development with custom addons or enterprise addons, we need to create Dockerfile, docker-compose.yml, and odoo.conf. You can follow this step:
- Create a new directory for project root. You can give any name for the directory.
- Create a new directory, ex: addons-extra. Then put all your custom addons in there.
- If you use enterprise edition, create a new directory, ex: addons-enterprise. Then put all enterprise addons in there.
- Create docker-compose.yml. Copy the code below:
- Create a new directory config/ and a new file odoo.conf inside the config directory. Copy the code below:
- Optional, we can create a .dockerignore file used for ignoring some files to processed with docker such as .git file. Copy the code below:
- And this is the tree result of the project directory.
Build and Run
After setup, we need to build an image and run the container.
- Make sure that pointer in the project root directory.
docker-compose run --service-ports webto run Odoo web & DB container.
- For shortcut commands we can use
docker-compose upto build image & start the container.
- Open your browser and type
localhost:9069in the address bar.
- When we run the container, it will automatically create docker volume
odoo-web-datadirectory. All odoo data like attachment will be placed in
odoo-web-dataand all Postgres data will be placed in
That’s it. Thanks for reading.