Skip to Content
  • Reasonable cost commitment
  • Quality commitment
  • On-schedule commitment

How to Install Odoo 20 with Docker (Step by Step)

Odoo 20 with Docker Compose: the compose file, the config, the first database, custom addons, backup and restore. Tested on the official image.

Share

On this page

No headings in this post

The quickest way to try Odoo 20 on your own machine is Docker Compose with two containers: the official odoo:20 image and PostgreSQL. This guide walks through the compose file, the configuration, the first database, custom addons, and backup and restore.

Tested on 18/11/2026 with Docker Desktop on Windows 11, Docker Engine 28.4.0, Docker Compose v2.39.2, the official odoo:20 image (build 20261112) and postgres:17 (PostgreSQL 17.12). Tested on Docker Desktop; we have not run this exact file on a Linux server.

What you need

  • Docker with Docker Compose v2 (Docker Desktop on Windows or macOS, or Docker Engine on Linux).
  • Port 8069 free on your machine.
  • A few GB of disk space for the images and data.

1. Create the project folder

odoo20/
├── compose.yaml
├── config/
│   └── odoo.conf
└── addons/

2. Write compose.yaml

services:
  db:
    image: postgres:17
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=odoo
      - POSTGRES_PASSWORD=change-me-db
    volumes:
      - odoo-db-data:/var/lib/postgresql/data
    restart: unless-stopped

  odoo:
    image: odoo:20
    depends_on:
      - db
    ports:
      - "8069:8069"
    environment:
      - HOST=db
      - USER=odoo
      - PASSWORD=change-me-db
    volumes:
      - odoo-web-data:/var/lib/odoo
      - ./config:/etc/odoo
      - ./addons:/mnt/extra-addons
    restart: unless-stopped

volumes:
  odoo-db-data:
  odoo-web-data:
  • HOST, USER and PASSWORD tell the Odoo image how to reach PostgreSQL. PASSWORD must match POSTGRES_PASSWORD.
  • The two named volumes keep the database and Odoo's filestore (attachments, images) when containers are removed.
  • ./config replaces the image's /etc/odoo, and ./addons is where your own modules go.

3. Write config/odoo.conf

[options]
addons_path = /mnt/extra-addons
data_dir = /var/lib/odoo
http_interface = 0.0.0.0
admin_passwd = change-me-master

Keep http_interface = 0.0.0.0. The image's own odoo.conf sets it. When you mount your own config folder, that file is replaced, and without this line Odoo 20 listens on 127.0.0.1 inside the container: the log says HTTP service running on 127.0.0.1:8069 and the browser can't connect. We hit exactly this in our test.

admin_passwd is the master password that protects the database manager (create, back up, restore, delete databases). Use a long random value.

4. Start Odoo

docker compose up -d
 Container odoo20-db-1  Started
 Container odoo20-odoo-1  Started

Check the log:

docker compose logs odoo
odoo: Odoo version 20.0-20261112
odoo: Using configuration file at /etc/odoo/odoo.conf
odoo.service.server: HTTP service running on 0.0.0.0:8069

While addons/ is still empty, the log also shows invalid addons directory '/mnt/extra-addons', skipped. That warning is harmless and goes away once the folder contains a module.

5. Create the first database and log in

Open http://localhost:8069. Odoo shows the database manager:

  1. Enter the master password (admin_passwd from odoo.conf).
  2. Choose a database name, for example mycompany.
  3. Enter the email and password for the first administrator.
  4. Choose the language and country.
  5. Click Create database.

In our test, creating the database took about 18 seconds, then Odoo opened the home screen. Log in with the email and password from step 3, then install apps from the Apps menu.

6. Add your own modules

Put each module in addons/. To create a skeleton module:

docker compose exec odoo odoo scaffold my_module /mnt/extra-addons

Restart Odoo so it sees the new folder, then install the module:

docker compose restart odoo
docker compose run --rm odoo -d mycompany -i my_module --stop-after-init --no-http

To update it after changing the code, use -u my_module instead of -i my_module.

Use docker compose run, not docker compose exec, for these commands. The image's entrypoint passes the database host, user and password from the environment variables. exec skips the entrypoint, so Odoo tries a local socket and fails with connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed. If you prefer exec, put db_host, db_user and db_password in odoo.conf.

The scaffolded module logs Missing 'license' key in manifest. Add 'license': 'LGPL-3' (or your license) to __manifest__.py.

To use Odoo Enterprise modules, mount the Enterprise addons folder the same way: there is no official Enterprise image.

7. Back up

Option A: database manager (database + filestore in one zip). Open http://localhost:8069/web/database/manager, click Backup next to the database, enter the master password and choose the zip format.

Option B: from the command line, for scheduled backups:

docker compose exec -T db pg_dump -U odoo -Fc mycompany > mycompany.dump
docker compose exec -T odoo tar czf - -C /var/lib/odoo filestore/mycompany > filestore.tgz

A backup needs both parts: the database (pg_dump) and the filestore (attachments). Keep copies off the machine that runs Odoo.

8. Restore

In the database manager, click Restore Database, enter the master password, choose the zip file and a new database name, and select This database is a copy if the original still runs. In our test, the restored database appeared next to the original right away.

9. Stop, start and keep your data

docker compose stop      # stop, keep everything
docker compose down      # remove containers, keep the volumes (data)
docker compose up -d     # start again

After down and up -d, both databases from our test were still there. Only docker compose down -v deletes the volumes, and with them the database and filestore.

Troubleshooting

Symptom Cause Fix
Browser can't connect, log says HTTP service running on 127.0.0.1:8069 Your odoo.conf replaced the image's and has no http_interface Add http_interface = 0.0.0.0
connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed Command run with docker compose exec, which skips the entrypoint's database settings Use docker compose run --rm odoo …, or set db_host/db_user/db_password in odoo.conf
invalid addons directory '/mnt/extra-addons', skipped addons/ is empty Harmless; add a module
Port 8069 already in use Another service uses it Map another port, e.g. "8070:8069", and open http://localhost:8070
Database manager asks for a master password you don't know admin_passwd not set or forgotten Set it in odoo.conf and restart Odoo

Before going to production

This setup is for trying Odoo and for development. A production server also needs at least: a reverse proxy with HTTPS in front of Odoo, proxy_mode = True, list_db = False once databases exist, strong passwords, multiple workers sized to the server, and automatic off-site backups.

If you'd rather have Odoo set up and run for you, see Odoo ERP implementation or contact the BMS team. For what changed in this release, read What's New in Odoo 20.

FAQ

Is there an official Odoo 20 Docker image?

Yes, odoo:20 on Docker Hub, maintained as a Docker Official Image. It contains Odoo Community; Enterprise modules can be mounted as extra addons.

Which PostgreSQL version should I use with Odoo 20 in Docker?

We tested with the official postgres:17 image (PostgreSQL 17.12), and Odoo 20 created, backed up and restored databases on it without errors.

Where does Odoo store data in Docker?

The database lives in the PostgreSQL volume (/var/lib/postgresql/data); attachments and other files live in Odoo's filestore under /var/lib/odoo. Back up both.


BMS is an Odoo partner implementing Odoo for businesses since 2018. If you would rather have Odoo set up and run for you, book a free consultation.

Book a free consultation →

Share

Contact

Tell us your business problem.

Book a free consultation with a BMS expert. We start from orders, inventory and receivables, then move to modules.

Book a free consultation
Hotline / Zalo
0963523434
Email
cs@bmstech.com.vn