SoFunction
Updated on 2025-03-09

Implementation of docker building odoo16 development environment

To use Docker to build the Odoo 16 development environment, we need to prepare two main files: one isFile to define and run multiple Docker application containers, including Odoo 16 and PostgreSQL 15; the other isFile to configure Odoo app. I will explain these two files in detail below.

1.

This file is used to define and run Odoo and PostgreSQL containers. Create a name calledand fill in the following content:

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:15
    environment:
      POSTGRES_DB: odoodb
      POSTGRES_USER: odoo
      POSTGRES_PASSWORD: odoo
    volumes:
      - odoo-db-data:/var/lib/postgresql/data

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

Parameter analysis:

  • version:Specifydocker-composeFile format version.
  • services: Define the service container to run.
  • web: Odoo service container.
    • image: The Odoo Docker image version used.
    • depends_on: Define dependencies between containers, where Odoo depends on database services.
    • ports: Map the ports of containers and hosts.
    • volumes: Mount volume for data persistence and configuration file sharing.
    • environment: Set environment variables, such as database host, username, and password.
  • db: PostgreSQL service container.
    • image: The PostgreSQL Docker image version used.
    • environment: Set environment variables, including database name, user name, and password.
    • volumes: Persistent storage of database data.

2.

Next, you need to prepare Odoo's configuration file. exist./configCreate a directory calledand fill in the following content:

[options]
; This is the password that allows database operations:
admin_passwd = admin
db_host = db
db_port = 5432
db_user = odoo
db_password = odoo
addons_path = /mnt/extra-addons

File parsing:

  • [options]: Identify the beginning of the configuration option.
  • admin_passwd: Set the administrator password for database operations.
  • db_host: Database host name, andThe service name in the corresponding.
  • db_port: Database port number.
  • db_user: Database username.
  • db_password: Database password.
  • addons_path: The path to the additional module.

Final steps

  • make suredocker-composeandDockerInstalled on your machine.
  • IncludedandRun in the same directory as the filedocker-compose up. Docker willThe definition in Starts Odoo 16 and PostgreSQL 15 containers.
  • Access through a browserhttp://localhost:8069

This is the end of this article about the implementation of docker building odoo16 development environment. For more related docker building odoo16 content, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!