Home > Software > How to Deploy Odoo 16 with Docker Compose: A Comprehensive Guide

How to Deploy Odoo 16 with Docker Compose: A Comprehensive Guide

Anastasios Antoniadis

Discover how to deploy Odoo 16 efficiently using Docker Compose with our step-by-step guide. Learn to set up a flexible, scalable ERP system with custom configurations and addons, ensuring a quick and hassle-free setup.

Docker (1)

Odoo is a popular open-source ERP (Enterprise Resource Planning) software that offers a wide range of business applications, from CRM and eCommerce to accounting and inventory management. Deploying Odoo using Docker Compose is an efficient way to get your ERP system up and running quickly, with the flexibility to scale and manage your deployment easily. This guide will walk you through setting up Odoo 16 using Docker Compose, including a step-by-step example of the necessary files and configurations.

Prerequisites

Before starting, ensure you have Docker and Docker Compose installed on your machine. These tools will create and manage the Odoo and PostgreSQL containers needed for your Odoo instance.

Step 1: Create Your Docker Compose File

Create a directory for your Odoo project, and inside this directory, create a file named docker-compose.yml. This file will define the services, networks, and volumes necessary for running Odoo and its database.

version: '3.7'

services:
  web:
    image: odoo:16
    depends_on:
      - db
    ports:
      - "8069:8069"
    volumes:
      - odoo-web-data:/var/lib/odoo
      - ./config:/etc/odoo
      - ./addons:/mnt/extra-addons
    environment:
      - HOST=db
      - USER=odoo
      - PASSWORD=odoo

  db:
    image: postgres:13
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_USER=odoo
      - POSTGRES_PASSWORD=odoo
    volumes:
      - odoo-db-data:/var/lib/postgresql/data

volumes:
  odoo-web-data:
  odoo-db-data:

Explanation of the Docker Compose File

  • Web Service: This service runs the Odoo 16 container. It depends on the db service to ensure the database is ready before starting. The service is mapped to port 8069 on the host, allowing access to Odoo through the browser. Volumes are used to persist Odoo data and to mount custom configuration and addon directories.
  • DB Service: This service runs a PostgreSQL 13 container, which is the database used by Odoo. Environment variables are set to configure the database credentials. A volume is used to persist the database data.

Step 2: Custom Configuration and Addons

  • Configuration: You can customize Odoo by placing a configuration file in the ./config directory. Odoo will automatically use this file on startup.
  • Addons: Place any custom or third-party addons in the ./addons directory to make them available in your Odoo instance.

Step 3: Launching Odoo

With your docker-compose.yml file in place, launch your Odoo instance by running the following command in the directory containing your Docker Compose file:

docker compose up -d

This command starts your Odoo and PostgreSQL containers in detached mode. You can now access your Odoo instance by navigating to http://localhost:8069 in your web browser.

Conclusion

Deploying Odoo 16 with Docker Compose offers a streamlined and effective method to get your ERP system running, whether for development, testing, or production environments. Following this guide, you can set up a flexible and scalable Odoo instance, ready to be customized with your configurations and addons. Docker and Docker Compose simplify the management of Odoo and its dependencies, making it easier to upgrade, backup, and scale your Odoo deployment as needed.

Anastasios Antoniadis
Follow me
Latest posts by Anastasios Antoniadis (see all)
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x