Installing Odoo with Docker on Ubuntu: Complete Guide

11.12.2025
19:26

Odoo is a powerful open-source ERP system built with Python. It covers a wide range of business processes: from accounting and inventory management to CRM and project management. Thanks to its modular architecture, Odoo easily adapts to any business specifics.

In this guide, we'll install Odoo via Docker Compose alongside PostgreSQL, configure Nginx as a reverse proxy, and secure the connection with a TLS certificate from Let's Encrypt.

Prerequisites

To follow this tutorial, you'll need:

Ubuntu server with at least 2 CPUs and the following setup:

  • Non-root user with sudo privileges
  • Configured firewall (UFW)
  • Follow our initial server setup guide

Installed Docker:

  • Complete steps 1 and 2 from the Docker installation guide for Ubuntu
  • Ensure your user can run docker commands without sudo

Domain name for enabling HTTPS:

  • Configure an A record pointing to your server's IP address
  • This can be odoo.example.com or any other subdomain

If you're using DigitalOcean, you can start with the One-Click Docker image, which comes with Docker, Docker Compose, and UFW pre-installed.

Step 1: Installing Docker Compose

Docker Compose is a tool for managing multi-container applications through a single configuration file.

Update your package list and install Docker Compose:

sudo apt update
sudo apt install docker-compose

Verify the installation:

docker-compose --version

You should see output like:

docker-compose version 1.29.2, build unknown

Alternative: if you want to use a newer version of Docker Compose, install it directly from GitHub. In this case, the command will be docker compose (with a space) instead of docker-compose.

Step 2: Running Odoo and PostgreSQL with Docker Compose

Create a directory for the project:

mkdir ~/odoo
cd ~/odoo

Create the docker-compose.yml file:

nano docker-compose.yml

Add the following configuration:

version: '3'
services:
  odoo:
    image: odoo:15.0
    env_file: .env
    depends_on:
      - postgres
    ports:
      - "127.0.0.1:8069:8069"
    volumes:
      - odoo-dаta:/var/lib/odoo
  postgres:
    image: postgres:13
    env_file: .env
    volumes:
      - postgres-dаta:/var/lib/postgresql/data/pgdata

volumes:
  odoo-dаta:
  postgres-dаta:

Configuration breakdown:

  • odoo — service running Odoo version 15.0
  • postgres — PostgreSQL 13 database
  • depends_on — Odoo starts only after PostgreSQL
  • ports — port 8069 available locally on the host
  • volumes — data persists in named volumes
  • env_file — environment variables loaded from .env file

Save the file (Ctrl+O, Enter, Ctrl+X in nano).

Now create the environment variables file:

nano .env

Add the following lines, replacing passwords with generated ones:

# PostgreSQL settings
POSTGRES_DB=postgres
POSTGRES_PASSWORD=your_strong_postgres_password
POSTGRES_USER=odoo
PGDATA=/var/lib/postgresql/data/pgdata

# Odoo settings
HOST=postgres
USER=odoo
PASSWORD=your_strong_postgres_password

Generate a secure password:

openssl rand -base64 30

Copy the generated string and use it as the password in both places (POSTGRES_PASSWORD and PASSWORD).

Save the file.

Start the containers:

docker-compose up -d

The -d flag runs containers in the background. Docker Compose will download required images and start the services:

Creating network "odoo_default" with the default driver
Creating volume "odoo_odoo-data" with default driver
Creating volume "odoo_postgres-data" with default driver
Pulling odoo (odoo:15.0)...
...
Creating odoo_postgres_1 ... done
Creating odoo_odoo_1     ... done

Verify that Odoo is running:

curl --head http://localhost:8069

You should see HTTP headers with code 303 SEE OTHER:

HTTP/1.0 303 SEE OTHER
Content-Type: text/html; charset=utf-8
Location: http://localhost:8069/web
...

This means Odoo successfully started and is redirecting to the setup page.

Container management:

Stop containers:

docker-compose stop

Restart:

docker-compose start

View logs:

docker-compose logs -f odoo

Step 3: Installing and Configuring Nginx

Nginx will act as a reverse proxy, handling incoming requests and passing them to the Odoo container. This improves performance and security.

Install Nginx:

sudo apt install nginx

Allow HTTP and HTTPS traffic through the firewall:

sudo ufw allow "Nginx Full"

Create a configuration file for Odoo:

sudo nano /etc/nginx/sites-available/odoo.conf

Add the following configuration, replacing your_domain with your actual domain:

server {
    listen 80;
    listen [::]:80;
    server_name your_domain;

    access_log /var/log/nginx/odoo.access.log;
    error_log /var/log/nginx/odoo.error.log;

    location / {
        proxy_pass http://127.0.0.1:8069;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto https;
    }

    location /longpolling {
        proxy_pass http://127.0.0.1:8072;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto https;
    }

    client_max_body_size 100M;
}

Configuration explained:

  • location / — handles all regular requests
  • location /longpolling — special Odoo endpoint for WebSocket connections
  • proxy_set_header — passes important headers to Odoo
  • client_max_body_size — maximum upload file size

Enable the configuration:

sudo ln -s /etc/nginx/sites-available/odoo.conf /etc/nginx/sites-enabled/

Check syntax:

sudo nginx -t

If everything's correct, reload Nginx:

sudo systemctl reload nginx

Now Odoo is accessible at http://your_domain. But before configuring the system, secure the connection with an HTTPS certificate.

Step 4: Installing Certbot and Setting Up TLS

Certbot automates obtaining and renewing free SSL certificates from Let's Encrypt.

Install Certbot with the Nginx plugin:

sudo apt install certbot python3-certbot-nginx

Run Certbot for your domain:

sudo certbot --nginx -d your_domain

Certbot will ask:

  1. Email — for certificate expiration notifications
  2. Terms agreement — answer Yes
  3. HTTP → HTTPS redirect — recommended to choose Yes

After successful completion, you'll see:

Congratulations! You have successfully enabled https://your_domain

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/your_domain/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/your_domain/privkey.pem
   Your cert will expire on 2025-03-15. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"

Certbot automatically:

  • Obtained a certificate from Let's Encrypt
  • Modified Nginx configuration to support HTTPS
  • Set up automatic certificate renewal

Your site is now accessible via secure HTTPS protocol.

Verify auto-renewal:

sudo systemctl status certbot.timer

The timer should be active. It will automatically renew certificates before expiration.

Step 5: Configuring Odoo via Web Interface

Open your browser and navigate to https://your_domain. You'll see Odoo's initial setup page.

Fill in the form:

Master Password:

  • This is the administrative password for database management
  • Generate a strong password and store it securely
  • Used only for creating/deleting databases

Database Name:

  • Enter production or any other name

Email:

  • Your email for system login

Password:

  • Odoo administrator password (don't confuse with master password)

Demo dаta:

  • Keep enabled if you want to test the system with sample data
  • Disable for actual work

Click Create database. The process takes 1-2 minutes.

After database creation, you'll be redirected to Odoo's main dashboard with a catalog of available modules.

Installing and Using Odoo Modules

Odoo offers numerous modules for various business processes:

Popular modules:

  • Sales — sales management, quotes, and orders
  • CRM — customer and lead management
  • Invoicing — billing and financial accounting
  • Inventory — warehouse accounting and logistics
  • Project — project and task management
  • Website — website builder
  • eCommerce — online store

To install a module:

  1. Click on the desired module tile
  2. Click Install
  3. Wait for installation to complete

After installation, the module appears in the main applications menu (icon in top-left corner).

Backup and Restore

Creating Database Backup

Via web interface:

  1. Navigate to https://your_domain/web/database/manager
  2. Enter master password
  3. Select database
  4. Click Backup
  5. Download the archive

Via command line:

docker exec -t odoo_postgres_1 pg_dump -U odoo postgres > odoo_backup.sql

Restoring from Backup

Via web interface:

  1. Go to Database Manager
  2. Click Restore
  3. Upload backup file

Via command line:

cat odoo_backup.sql | docker exec -i odoo_postgres_1 psql -U odoo postgres

Updating Odoo

To update to a new Odoo version:

  1. Create a data backup
  2. Change version in docker-compose.yml:
services:
  odoo:
    image: odoo:16.0  # new version
  1. Rebuild containers:
docker-compose down
docker-compose pull
docker-compose up -d
  1. Update modules via web interface or command:
docker exec -it odoo_odoo_1 odoo -u all -d postgres

Performance Optimization

Increasing Worker Processes

Edit docker-compose.yml:

services:
  odoo:
    image: odoo:15.0
    command: --workers=4 --max-cron-threads=2

Setting Memory Limits

services:
  odoo:
    image: odoo:15.0
    deploy:
      resources:
        limits:
          memory: 2G

Enabling Logging

services:
  odoo:
    image: odoo:15.0
    volumes:
      - ./logs:/var/log/odoo

Troubleshooting Common Issues

Problem: Odoo doesn't start after server reboot.

Solution: Configure Docker containers autostart:

services:
  odoo:
    restart: always
  postgres:
    restart: always


Problem: "Database connection failure" error.

Solution: Check if PostgreSQL is running:

docker-compose ps

Verify passwords in .env file.


Problem: Large files won't upload.

Solution: Increase client_max_body_size in Nginx configuration:

client_max_body_size 500M;

Reload Nginx:

sudo systemctl reload nginx


Problem: Slow Odoo performance.

Solution: Increase worker count and check server resources:

docker stats

Security

Restricting Database Manager Access

Add to Nginx configuration:

location /web/database {
    deny all;
    return 404;
}

This blocks public access to the database management page.

Firewall Configuration

Ensure port 8069 is closed externally:

sudo ufw status

Only ports 80, 443, and SSH should be open.

Regular Updates

Keep track of security updates:

sudo apt update
sudo apt upgrade
docker-compose pull
docker-compose up -d

Conclusion

You've deployed a full-featured Odoo ERP system using Docker Compose, configured a reverse proxy through Nginx, and secured the connection with a TLS certificate from Let's Encrypt.

Odoo is ready to use. You can now install necessary modules, configure business processes, and integrate the system with other services.

Next steps:

  • Explore official Odoo documentation for advanced configuration
  • Set up integrations with email and payment systems
  • Develop custom modules for specific needs
  • Configure regular backups

For custom module development, refer to the Developer Documentation.

Other articles

11.12.2025
79
Knowledge base / Automatic installation of scripts
How to Install Odoo on a VPS in Just a Few Minutes
11.12.2025
120
Knowledge base / Instructions
Files /etc/passwd and /etc/shadow: Structure and Operations
11.12.2025
119
Knowledge base / Instructions
Fixing Black Screen Issues in RDP Connection