Setup Odoo with Docker Compose


What is Odoo?

Odoo is one of the most popular business management software which provides features like CRM, e-commerce, billing, accounting, manufacturing, warehouse, project management, and inventory management in a single application. It provides an Enterprise edition and a Community edition which is LGPLv3 open source version. The source code for the framework and core ERP modules is curated by the Belgium-based Odoo S.A. Odoo was released on February 2005 and is written in Python, JavaScript and XML. It uses PostgreSQL as database platform technology. It was renamed from OpenERP in 2014. [Odoo Official Website], [Wikipedia Article on Odoo], [List of ERP software packages - Wikipedia]

Features of Odoo Community(open-source) Edition

Odoo Community(open-source) Edition has the following features: [Compare Odoo Editions]

Odoo Community Edition Features
├── User interface
│   └── Desktop
├── Accounting
│   └── Invoicing & Payments
├── Project Management
│   ├── Tasks
│   └── Timesheets
├── Sales Management
│   ├── CRM
│   ├── Sales
│   └── Customer
├── Human Resources
│   ├── Employee Directory
│   ├── Expenses
│   ├── Leaves
│   ├── Recruitments
│   └── Expenses
├── Inventory
│   ├── Inventory Management
│   └── Purchase Management
├── Manufacturing
│   ├── MRP
│   └── Maintenance
├── Website Builder
│   ├── Website Builder
│   ├── Blogs
│   ├── Presentations
│   └── Themes
├── E-commerce
│   └── Full eCommerce
├── Point of Sale
│   ├── Point of Sale
│   └── PoS Restaurants
├── Marketing
│   ├── Events
│   ├── Email Marketing
│   ├── Live Chat
│   └── SMS Marketing
└── Miscellaneous
    ├── E-Learning
    ├── Chat
    ├── Events
    ├── Google Spreadsheet Integration
    ├── Fleet
    └── Notes

While other ERP systems are complex to maintain, Odoo is friendlier to setup and to use. It’s not just one application, it’s combination of hundreds. Odoo is an enterprise resource platform which can be used to manage a versatile of business operations from supply chain and project management to accounting and human resource. Additionally it consists of messaging, sales CRM and reporting modules. Odoo is the most installed business software in the world. Odoo is used by 2.000.000 users worldwide ranging from very small companies (1 user) to very large ones (300 000 users). It is downloaded over 10M+ times from Docker Hub. [Odoo Docker Official Image]

Setup Odoo with Docker Compose

Odoo can be setup using Docker Compose. Odoo maintains the Docker Official Image of Odoo which is available in Docker Hub.

Prerequisite

  • Docker Engine should be installed in local machine. Instructions on installing Docker Engine on Ubuntu can be found in this tutorial: Install Docker on Ubuntu 18.04
  • Docker Compose should be installed in local machine. Instructions on installing Docker Compose on Ubuntu can be found in this tutorial: Install Docker Compose on Ubuntu 18.04

Environment

  • Operating System : Ubuntu 18.04 LTS (64-bit)
  • Processor : Intel® Core™ i7-8750H CPU @ 2.20GHz × 12
  • Memory : 15.3 GiB

Docker compose file

Create a docker-compose.yml file with following content:

version: '2'
services:
  web:
    image: odoo:12.0
    depends_on:
      - mydb
    ports:
      - "8069:8069"
    environment:
    - HOST=mydb
    - USER=odoo
    - PASSWORD=myodoo
  mydb:
    image: postgres:10
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=myodoo
      - POSTGRES_USER=odoo

This file tells Docker Engine to create a service called web. This service pulls Odoo version 12 image from Docker Hub registry. This web service depends on another service called mydb. It binds container’s 8069 port to host machine’s 8069 port. Finally it sets several environment variables such as HOST, USER and PASSWORD.

In mydb service it pulls postgres version 10 image from Docker Hub registry and sets environment variables for setting up the database name, user and password.

Disclaimer: This docker-compose.yml file does not include any information regarding volume and or data directory. So after each time the container is down all data will be lost.

Let’s build and run the services in the background using -d(detached mode) flag. [Get started with Docker Compose]

Build and run Odoo on Docker

docker-compose up -d

This will build and run the container.

alt Build and run Odoo

We can see the running docker containers by:

docker ps

or

docker-compose ps

We can also see all containers using:

docker ps -a

or

docker-compose ps -a

To see how much space the containers take use:

docker ps -s

Here -a stands for --all and -s stands for --size option.

Configure database and applications for Odoo

We can now access Odoo from: 0.0.0.0:8069. At first run we need to setup the database:

alt Configure Odoo Database Marking Demo data checkbox will load Odoo with demo data.

After creating the database, we will get a dashboard page to install the apps we desire to use in Odoo.

alt Install apps

For example, we can install CRM app and after successful installation we will get CRM dashboard:

alt CRM app

For the apps we can see two options: install or upgrade. The apps with upgrade indicates that these apps are only available to Enterprise edition. We can install the apps which are available in Community edition.

Docker compose command to stop and remove containers

To stop container services use:

docker-compose stop

To remove the containers entirely:

docker-compose down

Reference