This repository contains a Docker Compose configuration for running Odoo 18 with PostgreSQL 17 database.
- db: PostgreSQL 17 database server
- odoo: Main Odoo application server
- odoo-init: Initialization service for setting up Odoo with all modules
- Docker
- Docker Compose
- At least 4GB of available RAM
- Ports 8069 and 5432 available on your host machine
-
Clone or download this configuration
-
Create the required directories:
mkdir -p config addons db/init
-
Start the services:
docker-compose up -d
-
Wait for initialization to complete (check logs):
docker-compose logs -f odoo-init
-
Access Odoo at: http://localhost:8069
.
├── docker-compose.yml
├── config/ # Odoo configuration files
├── addons/ # Custom Odoo addons
├── db/
│ └── init/ # Database initialization scripts
└── README.md
- Database: odoo
- Username: admin
- Password: admin (set during first setup)
- Image: postgres:17
- Port: 5432 (exposed)
- Database: odoo
- User: odoo
- Password: odoo
- Data persistence:
odoo_db_data
volume
- Image: odoo:18
- Port: 8069 (exposed)
- Data persistence:
odoo_web_data
volume - Custom addons: Mount
./addons
directory - Configuration: Mount
./config
directory
- Runs once to initialize the database with all modules
- Automatically stops after initialization
- Same volumes as main Odoo service
docker-compose up -d
docker-compose down
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f odoo
docker-compose restart odoo
docker-compose exec db psql -U odoo -d odoo
docker-compose down -v
docker-compose up -d
Place your odoo.conf
file in the ./config
directory. Example:
[options]
addons_path = /mnt/extra-addons,/usr/lib/python3/dist-packages/odoo/addons
data_dir = /var/lib/odoo
db_host = db
db_port = 5432
db_user = odoo
db_password = odoo
Place your custom Odoo addons in the ./addons
directory. They will be automatically available in Odoo.
Place any SQL scripts in ./db/init
directory to run them during database initialization.
- Check if database is healthy:
docker-compose ps
- Check logs for errors:
docker-compose logs db docker-compose logs odoo
If ports 8069 or 5432 are already in use, modify the port mappings in docker-compose.yml
:
ports:
- "8070:8069" # Change host port
Ensure the volumes have correct permissions:
sudo chown -R 101:101 config addons
Verify database service is running and healthy:
docker-compose exec db pg_isready -U odoo
docker-compose exec db pg_dump -U odoo odoo > backup.sql
docker-compose exec -T db psql -U odoo odoo < backup.sql
docker run --rm -v odoo_odoo_web_data:/data -v $(pwd):/backup alpine tar czf /backup/odoo_data.tar.gz /data
The PostgreSQL service includes a health check that ensures the database is ready before starting Odoo. This prevents connection errors during startup.
All services run on the odoo_network
bridge network, allowing secure internal communication between containers.