Odoo 19 in Docker: Complete Installation Guide for Ubuntu 24.04 (Community & Enterprise)
Introduction
Deploying an ERP system often seems like a daunting task, but containerization turns this process into a streamlined workflow. In this guide, we will walk through how to set up Odoo 19 on a fresh Ubuntu 24.04 instance.
The main highlight of this method is its versatility. We are defining an architecture that allows you to start with the free Community version while maintaining the ability to instantly upgrade to Enterprise by simply copying modules. No "on-the-fly" config hacks – just clean container management and automatic SSL via Caddy.
Technical Stack (Verified):
- OS: Ubuntu 24.04 LTS (Since this is a Docker installation, the method applies to other Linux distributions as well)
- Containerization: Docker 29.1.5 + Docker Compose
- Web Server: Caddy (Automatic HTTPS)
- Database: PostgreSQL 18
- VM Specs: 2 vCPU, 4 GB RAM, 40 GB NVMe
Step 0: Install Docker
Install Docker from the official repository:
curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh
Add your user to the docker group:
sudo usermod -aG docker $USER newgrp docker
Enable and start Docker:
sudo systemctl enable docker sudo systemctl start docker
Verify the installation:
docker ps
Step 1: Set Up the Project Structure
Create the working directory and necessary folders:
mkdir odoo-stack && cd odoo-stack mkdir -p addons enterprise
Step 2: Create docker-compose.yml
Create a new Docker Compose file:
nano docker-compose.yml
Paste the following configuration (replace odoo_secure_password in both the db environment and odoo environment sections with your actual password):
YAML
services: db: image: postgres:18 environment: - POSTGRES_DB=postgres - POSTGRES_PASSWORD=odoo_secure_password - POSTGRES_USER=odoo - PGDATA=/var/lib/postgresql/data/pgdata volumes: - odoo-db-data:/var/lib/postgresql/data/pgdata restart: unless-stopped odoo: image: odoo:19.0 depends_on: - db volumes: - odoo-web-data:/var/lib/odoo - ./addons:/mnt/extra-addons - ./enterprise:/mnt/enterprise-addons environment: - HOST=db - USER=odoo - PASSWORD=odoo_secure_password command: > --addons-path=/usr/lib/python3/dist-packages/odoo/addons,/mnt/enterprise-addons,/mnt/extra-addons --proxy-mode restart: unless-stopped caddy: image: caddy:latest ports: - "80:80" - "443:443" volumes: - ./Caddyfile:/etc/caddy/Caddyfile - caddy-data:/data restart: unless-stopped volumes: odoo-web-data: odoo-db-data: caddy-data:
Step 3: Create the Caddyfile
Create the Caddy configuration file:
nano Caddyfile
Paste the configuration below (replace :80 with your domain for automatic SSL):
# Replace :80 with YOUR_DOMAIN for automatic SSL :80 { # Increase client max body size for file uploads request_body { max_size 300MB } # Longpolling for chats and notifications reverse_proxy /longpolling/* odoo:8072 { header_up X-Forwarded-Host {host} header_up X-Forwarded-Proto {scheme} } # Main traffic reverse_proxy odoo:8069 { header_up X-Forwarded-Host {host} header_up X-Forwarded-Proto {scheme} } }
Step 4: Launch the Stack
Start the stack:
docker compose up -d
Check the status (all 3 containers should be "Up"):
docker compose ps
Check the logs to ensure there are no errors:
docker compose logs odoo
Step 5: Initial Setup
Open your browser and navigate to:
- Via IP: http://YOUR_SERVER_IP
- Via Domain: https://YOUR_DOMAIN (if configured in the Caddyfile)
Complete the database creation form:
- Master Password: A master password will be suggested on the first login (save this password, it is critical).
- Database Name: e.g., mycompany.
- Email: Your accessible email address (this will be your login).
- Password: Your system login password.
- Language: Select your preferred language.
- Country: Select your country.
- Demo Data: Leave unchecked for a clean production database.
Click Create database and wait for the process to complete (1-2 minutes).

Upgrading from Community to Enterprise
To switch from Community to Enterprise, simply place the modules in the designated directory.
Step 1. Obtain Enterprise modules (via Odoo subscription).
Step 2. Extract them into the ./enterprise/ folder.
Step 3. Restart the container:
docker compose restart odoo
Step 4. Install the required Enterprise modules via the UI.
No changes to configuration files are needed – the path to enterprise modules is already pre-configured.
Firewall Configuration
If you are using UFW, run the following:
sudo ufw allow ssh/tcp && \ sudo ufw allow 80/tcp && \ sudo ufw allow 443/tcp && \ sudo ufw default deny incoming && \ sudo ufw default allow outgoing && \ sudo ufw --force enable
Useful Commands
Stop everything:
docker compose down
Restart Odoo only:
docker compose restart odoo
View logs:
docker compose logs -f odoo docker compose logs -f db docker compose logs -f caddy
Database Backup:
docker compose exec db pg_dumpall -U odoo > backup_$(date +%Y%m%d).sql
Restore Database:
cat backup_20240125.sql | docker compose exec -T db psql -U odoo
Complete Wipe (Caution!):
docker compose down -v rm -rf addons enterprise Caddyfile
Using a Domain Name
To obtain an automatic SSL certificate from Let's Encrypt:
Step 1. Configure DNS: Point an A-record from YOUR_DOMAIN to your server's IP.
Step 2. Update Caddyfile: Replace :80 with YOUR_DOMAIN.
Step 3. Restart Caddy:
docker compose restart caddy
Caddy will automatically provision the SSL certificate.
Step 4. Access Odoo via https://YOUR_DOMAIN.
Verify certificate issuance:
docker compose logs caddy | grep certificate