If you're looking to set up an Odoo server efficiently, especially for development or testing purposes, deploying it via Docker offers numerous advantages. One of the primary benefits is the ability to "containerize" your Odoo server. This means the Odoo environment is isolated within a virtual container, preventing any impact on the rest of your server's system. This method is exceptionally practical, quick, and secure for conducting tests, though it's robust enough to support full production environments as well.
This guide provides a basic, step-by-step approach based on the Elico-Corp Odoo Docker repository. While specifically tailored for Ubuntu OS, these steps can be easily adapted for macOS or Windows.
Step-by-Step Guide to Installing OCA Modules with Docker
-
Install Docker and Docker Compose
Begin by installing Docker and Docker Compose on your system. These tools are fundamental for managing containerized applications, enabling you to deploy Odoo and its dependencies with ease.
-
Create the Directory Structure
To organize your Odoo project effectively, you need to create a specific directory structure. Assuming your base installation directory will be named
odoo, execute the following commands:mkdir odoo && cd odoo mkdir -p ./volumes/postgres ./volumes/odoo/addons ./volumes/odoo/filestore ./volumes/odoo/sessionsThis command creates the main
odoodirectory and crucial subdirectories for PostgreSQL data, Odoo addons, filestore, and sessions. This structure ensures persistent data storage and a clean separation of concerns within your containerized Odoo instance. -
Create Your
docker-compose.ymlFileNext, you'll define your Odoo and PostgreSQL services using a
docker-compose.ymlfile. Create this file within yourodoodirectory and populate it with the following content:version: '3.3' services: postgres: image: postgres:9.5 volumes: - ./volumes/postgres:/var/lib/postgresql/data environment: - POSTGRES_USER=odoo odoo: image: elicocorp/odoo:10.0 command: start ports: - 127.0.0.1:8069:8069 volumes: - ./volumes/odoo/addons:/opt/odoo/additional_addons - ./volumes/odoo/filestore:/opt/odoo/data/filestore - ./volumes/odoo/sessions:/opt/odoo/data/sessions links: - postgres:db environment: - ADDONS_REPO=https://github.com/OCA/business-requirement.git - ODOO_DB_USER=odooThis configuration establishes a PostgreSQL database container and an Odoo application container, linking them securely. It also mounts local volumes for persistent data and configures environment variables, including a crucial link to the OCA business-requirement repository for automatic module integration.
-
Fire Up Your Container
With the
docker-compose.ymlfile correctly configured, navigate back to yourodoodirectory in your terminal and execute the following command to launch your containers:docker-compose up -d odooThe
-dflag ensures that the containers run in detached mode, allowing them to operate in the background without tying up your terminal. This command will initiate both the Odoo service and its dependent PostgreSQL database. -
Access Odoo via Web Browser
Once your containers are fully operational, open your preferred web browser and navigate to the URL you configured in your
docker-compose.ymlfile. In this specific example, the address is http://127.0.0.1:8069. You should now see the Odoo setup interface. -
Create a New Database
Upon your first access to the Odoo instance, you will be prompted to create a new database. Follow the on-screen instructions to set up your primary database, providing the necessary details such as master password, database name, and language.
-
Update the Addons List
After successfully creating your database, it is essential to update the list of available modules. First, activate developer mode in Odoo (usually found in the settings or by clicking "About Odoo" multiple times). Then, navigate to
Apps > Update Apps Listfrom the Odoo menu to refresh the module list, ensuring that all newly added modules, including those from the OCA repository, are recognized. -
Install the Business Requirements Modules
Finally, with the addons list updated, proceed to the
Appsmenu within Odoo. Search for "Business Requirements" and click to install the relevant modules. These powerful modules, provided by the Odoo Community Association (OCA), are now readily available thanks to your Docker Compose configuration and will extend Odoo's functionality significantly.
Further Customization and Optimization
To further enhance and customize your Odoo Docker environment, you can explore additional parameters, change default passwords, or configure advanced settings. Detailed documentation and advanced configuration options are available at the Elico-Corp Odoo Docker repository. This resource provides comprehensive guidance for optimizing your Odoo deployment to meet specific operational requirements.
