Odoo17: Installation Docker

Drownie - Sep 2 - - Dev Community

Introduction

Hello Everyone, I want to share with you guys about my experience in Odoo Development. In this article i will specifically share about the installation process for odoo17 in docker so we doesn't need to install too much dependencies.

Advantage and disadvantages using odoo docker

Advantage:

  • Simple installation progress.

    Without docker we need to install a lot of dependencies, setting user, etc.

Disadvatage:

  • Hard to change the dependencies.

    In docker it is hard for us to change the dependencies. if we want to change the dependencies we must enter the docker through docker exec env.

Create the docker compose file

First we need to create the compose.yml file in the root folder. We need to first configure the odoo docker image version according to available versions from this documentation. In this tutorial I am using odoo:17.0 and make the odoo forward the port to 10017. Because Odoo is using postgreSQL as their db we can also add postgre db to the compose file.

Here is the example compose.yml code:

version: '3.1'
services:
  web:
    image: odoo:17.0 # Configure docker image version
    user: root
    depends_on:
      - db
    tty: true
    ports:
      - "10017:8069"
    volumes: # Configure Volumes
      - ./logs:/etc/odoo-logs/
      - ./config:/etc/odoo/ # Odoo Config Path
      - ./odoo_github/addon_custom:/mnt/extra-addons
    environment:
      - HOST=db
      - USER=odoo
      - PASSWORD=strongpassword # Should be the same as PG DB
  db:
    image: postgres:16
    environment: # Configure DB
      - POSTGRES_USER=odoo
      - POSTGRES_PASSWORD=strongpassword
      - POSTGRES_DB=postgres
      - PGDATA=/var/lib/postgresql/data/pgdata
    ports:
      - "5432:5432"
    volumes:
      - odoo-db-data:/var/lib/postgresql/data/pgdata
volumes:
  odoo-web-data:
  odoo-db-data:
Enter fullscreen mode Exit fullscreen mode

Create the odoo.conf File

We should also create the odoo.conf file for odoo configuration. For the conf file location should be placed according to the compose file, if you follow this tutorial the location will be on config/odoo.conf. This file is used to configure the Odoo setting for example the master password, odoo app port, addons path, log path, etc. For more information about odoo configuration file you can check this out.

Here is the example odoo.conf:

[options]
data_dir = /etc/odoo
admin_passwd = easypassword

dev_mode = reload

xmlrpc_port = 8069

logfile = /etc/odoo-logs/odoo-server.log
addons_path = /mnt/extra-addons
Enter fullscreen mode Exit fullscreen mode

Running the docker

To run the docker we can simply run the code below.

docker compose up -d
Enter fullscreen mode Exit fullscreen mode

After running the docker you can go to the browser and enter http://localhost:10017. If everything is okay you should be able to see this page below.

Odoo Login page

Project Path

Below is the project path for this entire tutorial.

root
|
├── compose.yml
|
├── config
|    └── odoo.conf
|
└── logs
     └── odoo-server.log
Enter fullscreen mode Exit fullscreen mode

Final words

This is the end of odoo docker installation tutorial. If you want the git code base you can get it here. I will continue the tutorial in the next article about getting started in odoo.

.
Terabox Video Player