Odoo development with DDEV
I recently had to develop a tiny Odoo module and wanted to use DDEV for the task. Here's how I set up Odoo with DDEV.
Thanks to DDEV's flexibility, completing this task was relatively straightforward. Let me walk you through the process.
First, we need to install Odoo in the DDEV Docker image. This is achieved by adding a file named .ddev/web-build/Dockerfile.odoo, which contains additional Dockerfile commands that DDEV will append to its own Dockerfile.
These commands include installing extra packages, as well as installing Odoo from its official Debian repository.
However, I encountered a problem at this stage: The DDEV Docker image is based on Debian Trixie, which is not fully supported by Odoo.
In fact, Odoo depends on the python3-pypdf2 package, which is no longer available in Debian Trixie.
Instead, you need to install the python3-pypdf package. This means that Odoo is not installable out of the box on Debian Trixie, unless you install it from source.
After discussing all options with my Coding agent, I decided the best way to fix this is building and installing a fake python3-pypdf2 package which resulted in this code:
mkdir /tmp/pypdf2-fake \
&& cd /tmp/pypdf2-fake \
&& printf '%s\n' \
'Section: misc' \
'Priority: optional' \
'Package: python3-pypdf2' \
'Version: 9999.0' \
'Architecture: all' \
'Description: Dummy package for python3-pypdf2' \
' This package is provided by Debian python3-pypdf.' \
> control \
&& equivs-build control \
&& dpkg -i ./python3-pypdf2_9999.0_all.deb \
&& rm -rf /tmp/pypdf2-fake
The complete version of the .ddev/web-build/Dockerfile.odoo Dockerfile I added to my project looks like this:
# Install required tools needed by Odoo
RUN apt-get update && apt-get install -y wget gnupg ca-certificates equivs python3-ldap python3-pypdf python3-venv
# Prepare a fake python3-pypdf2 as Odoo has a hard dependency on this package but it is no longer available in Trixxie
RUN mkdir /tmp/pypdf2-fake \
&& cd /tmp/pypdf2-fake \
&& printf '%s\n' \
'Section: misc' \
'Priority: optional' \
'Package: python3-pypdf2' \
'Version: 9999.0' \
'Architecture: all' \
'Description: Dummy package for python3-pypdf2' \
' This package is provided by Debian python3-pypdf.' \
> control \
&& equivs-build control \
&& dpkg -i ./python3-pypdf2_9999.0_all.deb \
&& rm -rf /tmp/pypdf2-fake
# Add Odoo repository
RUN wget -O - https://nightly.odoo.com/odoo.key | gpg --dearmor -o /usr/share/keyrings/odoo-archive-keyring.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/odoo-archive-keyring.gpg] https://nightly.odoo.com/19.0/nightly/deb/ ./" > /etc/apt/sources.list.d/odoo.list
# Install Odoo
RUN apt-get update && apt-get install -y odoo
To ensure the /var/lib/odoo directory persists across restarts, I created an additional Docker Compose file .ddev/docker-compose.odoo.yaml that mounts the directory to a Docker volume.
services:
web:
volumes:
- ddev-odoo:/var/lib/odoo
volumes:
ddev-odoo:
name: ddev-odoo
By default, DDEV starts nginx with php-fpm to serve requests. However, we need to run Odoo server instead and expose it to the Traefik proxy that DDEV uses to route requests to the container. Luckily, DDEV supports generic web servers, as documented in their official documentation, since early 2025.
All it takes is some additional configuration. To achieve this, I created a file named .ddev/config.odoo.yaml with the following content:
webserver_type: generic
web_extra_daemons:
- name: "odoo"
command: "odoo -c /var/www/html/.ddev/odoo/odoo.conf"
directory: /var/www/html
web_extra_exposed_ports:
- name: "odoo"
container_port: 8069
http_port: 80
https_port: 443
The final piece of the puzzle is the Odoo configuration file. To add this, you'll need to create a file named .ddev/odoo/odoo.conf, which will contain the necessary Odoo configuration settings:
[options]
addons_path = /var/www/html/odoo_addons
data_dir = /var/lib/odoo
db_name = db
db_host = db
db_port = 5432
db_user = db
db_password = db
smtp_password =
smtp_user =
smtp_port = 1025
smtp_server = mailpit
smtp_ssl = False
email_from = odoo@example.com
In the root of my project, I created a directory named odoo_addons to store the Odoo modules I want to develop.
To initialize the DDEV setup, run ddev start. This command will build and start the DDEV environment.
Once the setup is up and running, I created the database and Odoo admin user by running:
ddev exec odoo db init db --force --username admin@example.com --password 'odoo123#'
