This repository provides a production-ready stack for running Odoo or OCB with PostgreSQL, using Docker Compose. It supports external addons, configurable runtime settings, and secure defaults.
- Odoo versions 16-19
- Source from OCA/OCB or Odoo SA repository
- PostgreSQL as the database backend
- Configurable via environment variables
- External addons support
- Secure admin password generation
- Persistent data and configuration
- Health checks for database
- Resource limits for Odoo workers
- Clone this repository or copy the files into your project directory.
- Edit
.envfile to set your preferred Odoo and database credentials[^1_3]. - Build and start the stack:
docker compose up -d.envfile (see example.env)ODOO_REPO: Odoo source repository (OCA/OCB or official Odoo)ODOO_BRANCH: Odoo version/branch (default:17.0)ODOO_UID,ODOO_USER: User and UID for Odoo processODOO_BASE_DIR,ODOO_SRC_DIR,ODOO_DATA_DIR: Paths for Odoo data and sourceODOO_DB_USER,ODOO_DB_PASSWORD: Database credentials[^1_3]
compose.yml- Defines Odoo and PostgreSQL services
- Exposes ports
8171(XML-RPC) and8172(gevent/longpolling) - Mounts volumes for addons, data, and configuration
- Sets resource limits and security defaults[^1_1]
entrypoint.sh- Sets up Odoo configuration from environment variables
- Generates a random admin password if not set
- Creates required directories and sets permissions
- Initializes the database if not already done
- Runs Odoo as the specified user[^1_4]
Dockerfile- Builds a Debian-based image with Python 3.12
- Installs system dependencies and wkhtmltopdf
- Creates the Odoo user and clones the source code
- Installs Python dependencies
- Sets up the entrypoint[^1_2]
- Addons: Place your custom addons in
./addonsdirectory. - Configuration: Edit
compose.ymlor.envto change Odoo or database settings. - Resources: Adjust memory and CPU limits in
compose.ymlas needed.
./addons: External Odoo addons./data: Odoo file store and sessions./conf: Odoo configuration files./data/postgres: PostgreSQL data directory
- Server admin password: Generated automatically if not set
- NOTE: The password is recorded in the logs
- Database password: Must be set in
.env - Resource limits: Prevents excessive resource usage
| Service | Port | Description |
|---|---|---|
| Odoo | 8171 | XML-RPC interface |
| Odoo | 8172 | Gevent/longpolling |
- PostgreSQL: Managed as a separate container
- Health check: Ensures database is ready before Odoo starts[^1_1]
- First run: The database and admin password will be initialized automatically.
- Restart: The stack can be restarted without losing data.
- Logging: Odoo logs to stdout by default.
This setup is suitable for development, testing, and small production environments. Adjust resource limits and security settings for larger deployments.