Installing Odoo from source or packages is fine, but when you want something clean, repeatable, and easy to move between systems, Docker just makes life easier. In this blog, I’ll walk you through setting up Odoo 18 using Docker on Ubuntu, step by step, with actual commands and practical explanations — the way most developers really do it.
This guide assumes you are using Ubuntu 20.04 / 22.04, have basic terminal knowledge, and want a working Odoo 18 setup without polluting your system.
Let’s check how to configure this.
Why Docker for Odoo?
Before jumping in, here’s why Docker is worth it:
-
No dependency conflicts (Python, wk html to pdf, PostgreSQL, etc.)
-
Easy to spin up, stop, or reset environments
-
Same setup works on any machine
-
Perfect for local development and testing
If you’ve ever broken your OS trying to fix Odoo dependencies, Docker feels truly relieved.
Step 1: Install Docker on Ubuntu
First, make sure your system is up to date.
sudo apt update
sudo apt upgrade –y
Install required packages:
sudo apt install -y ca-certificates curl gnupg lsb-release
Add Docker’s official GPG key:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Add Docker repository:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Install Docker Engine:
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify installation:
docker --version
docker compose version
Optional but recommended: run Docker without sudo.
sudo usermod -aG docker $USER
newgrp docker
Step 2: Create Project Directory
Let’s keep things organized.
mkdir odoo18-docker
cd odoo18-docker
Inside this directory, we’ll define everything Odoo needs.
Step 3: Create docker-compose.yml
Create the main Docker Compose file:
nano docker-compose.yml
Paste the following content:
version: '3.8'
services:
web:
image: odoo:18.0
container_name: odoo18
depends_on:
- db
ports:
- "8069:8069"
volumes:
- odoo-web-data:/var/lib/odoo
- ./addons:/mnt/extra-addons
- ./config/odoo.conf:/etc/odoo/odoo.conf
environment:
- HOST=db
- USER=odoo
- PASSWORD=odoo
restart: always
db:
image: postgres:15
container_name: odoo18-db
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=odoo
- POSTGRES_PASSWORD=odoo
volumes:
- odoo-db-data:/var/lib/postgresql/data
restart: always
volumes:
odoo-web-data:
odoo-db-data:
This sets up:
-
Odoo 18 container
-
PostgreSQL 15 database
-
Persistent volumes for data
-
Port 8069 exposed to your browser
Step 4: Create Odoo Config File
Create folders:
mkdir config addons
Now create the config file:
nano config/odoo.conf
Add this:
[options]
admin_passwd = admin
db_host = db
db_port = 5432
db_user = odoo
db_password = odoo
addons_path = /mnt/extra-addons
logfile = /var/log/odoo/odoo.log
You can change admin_passwd later — this is the master password for database management.
Step 5: Start Odoo 18 Containers
From the project root:
docker compose up -d
Check running containers:
docker ps
You should see:
-
odoo18
-
odoo18-db
If something goes wrong, logs are your best friend:
docker logs odoo18
Step 6: Access Odoo in Browser
Open your browser and go to:
You’ll land on the Odoo database creation screen.
Fill in:
-
Database Name
-
Email & Password
-
Select Language
-
Apps: Demo or Empty (your choice)
Click Create Database and wait a bit.
That’s it — Odoo 18 is running.
Step 7: Using Custom Addons
Any custom module you place inside:
addons/
Will be available automatically.
After adding modules:
-
Update Apps list from Odoo UI
or
-
Restart container:
docker restart odoo18
No rebuild required. Simple and clean.
Useful Docker Commands for Daily Work
Stop containers:
docker compose down
Start again:
docker compose up -d
Restart only Odoo:
docker restart odoo18
Enter Odoo container:
docker exec -it odoo18 bash
Enter PostgreSQL container:
docker exec -it odoo18-db psql -U odoo
Common Issues and Tips
-
Port already in use
Change "8069:8069" to "8070:8069" if needed.
-
Permission issues on addons
Make sure your addons folder is readable:
sudo chmod -R 755 addons
-
Database connection error
Check that db_host = db matches the service name.
-
Want wkhtmltopdf?
Official Odoo Docker image already includes a compatible version.
If required, you can even configure docker to start, stop and restart using pycharm itself just by adding the docker setup details in pycharm configurations.
In conclusion, using Docker to run Odoo 18 is probably going to be the easiest way to install and maintain Odoo 18. It provides a consistently clean environment every time you start up a new Docker instance, making it easy to avoid installing software or solving compatibility problems between different versions of Python.
If you're working with Odoo development, using Docker as part of your Odoo development process will save you time and hassle. After you have fully grasped using Docker, you can quickly set up additional tools like Nginx, SSL, backups, or multiple Odoo installations to make your process even more efficient.
To recap, if you want to be successful in Odoo development today, you need to use Docker because it is the only way to take full advantage of what Odoo has to offer.
Leave a comment