Enable Dark Mode!
By: Abdul Afras

Odoo 14 Deployment using Docker

Technical Odoo 14

Docker is a platform for application-level deployment that allows developers and users to build, deploy, run, and manage their apps using containers. These containers allow developers to combine different components of their software into a single instance to build packages/tools/environments/libraries etc. By doing this, developers in any other environment can run their applications without thinking about their variations in dependency. Moreover, in reality, Docker behaves like a virtual machine. By using Odoo Docker features, the user does not need to worry about dependencies, packages, and many more aspects.
Considering Odoo image it has all the required packages and libraries making the Odoo run with ease.
To deploy Odoo on Docker, initially, we needed to set up two docker containers. We can use the Postgres image and Odoo image for that.
1. Odoo Image: There is an official image of the Odoo in the Docker hub which can be installed into the Docker Container
2. Postgres Image: Odoo stores and manipulates its data using PostgreSQL. So before configuring the Odoo image we need to ensure that the Postgres image is running perfectly without any errors.

We are using Docker-compose to run multiple containers in a single service. In Odoo, it requires Odoo and PostgreSQL, we can create a file that includes both containers and we can start both the containers as a service as there is no necessity to start them individually.
Here I will be explaining how to run Odoo 14 using docker-compose.

Installing Docker-Compose:
Execute this command to download the compose file to /usr/local/bin directory:
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Now we can set executable permissions for the file using the following command:
sudo chmod +x /usr/local/bin/docker-compose
Check Docker version:
docker-compose --version
Deploying Odoo 14 using Docker-Compose:
Create a new directory for the project environment.
 mkdir -p ~/docker/odoo14
 cd ~/docker/odoo14
 touch docker-compose.yml
 mkdir ./config && touch config/odoo.conf
 mkdir ./addons
 mkdir ./enterprise #for adding the enterprise addons
 mkdir ./data
 mkdir ./data/odoo
 mkdir ./data/postgres #the data directory to hold the odoo data and postgres data 

Adding the contents into ./docker-compose.yml:
Sample docker-compose file is given below.
nano docker-compose.yml
version: '1.0'
  # Information needed set up an odoo web
  # application container.
image: odoo:14.0
container_name: odoo_14
    - db
# Port Mapping
#We need to map the port on the host machine(left side) to the
#Port inside the container on the right. By default Odoo 
#Runs on port 8069 and inside the container, it is running on 8069.
        #Locally we are going to access it via localhost:9000
  - 9000:8069
# Data Volumes
# --------
# This defines files that we are sharing from the host machine
# into the container.
#Here we are using to map the extra add ons or enterprise addons
# as well as the configuration file. Also, we need to map the data 
#directory where Odoo will storesome attachments etc.
  - ./data/odoo:/var/lib/odoo
        - ./config:/etc/odoo
        - ./addons:/mnt/extra
        - ./enterprise:/mnt/enterprise
#Username and password of the Host DB
# Make sure to give the same credentials
#inside the postgres service
  - HOST=db
  - USER=odoo14
  - PASSWORD=odoo14

  # All of the information needed to start up a Postgresql
  # container.
image: postgres:10
container_name: postgres_10
#Add this volume to map the Postgres data. It may be lost
#if we execute docker-compose down where all the data
#in the layered file system will be lost
        - ./data/postgres:/var/lib/postgresql/data
#make sure to use the same which were given above.
  - POSTGRES_USER=odoo14
  - POSTGRES_DB=postgres 
Odoo sample configuration needed to add inside ./config/odoo.conf to map the volume inside the container.
admin_passwd = admin_password
db_host = db
db_user = odoo14
db_password = odoo14
db_port = 5432
addons_path = /mnt/extra-addons , /mnt/enterprise
proxy_mode = True
data_dir = /var/lib/odoo
To run:-
docker-compose up  
You can see the log from both the Postgres as well as odoo. Once it is running we can access it from http://localhost:9000.
Docker-Compose Commands:
docker-compose up -d - Starts the containers in the background.
docker-compose restart - Restarts all the services.
docker-compose down - Destroys containers
docker-compose stop - Stops all the service

To install additional package inside the docker container: 
docker exec -it <container name> /bin/bash to get a bash shell in the container
docker exec -it <container name> <command> to execute the  command that specified

If you need any assistance in odoo, we are online, please chat with us.


Leave a comment




Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635



Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.



Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message