Deploying Odoo 14 Using Docker

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production. 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.

To deploy Odoo on Docker, we needed to set-up two docker containers.

  1. 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.
  2. Odoo Image : There is an official image of the Odoo in the Docker hub which can be installed into the Docker Container [https://hub.docker.com/_/odoo]

Docker-Compose:Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.

let’s create a file that includes Odoo and PostgreSQL containers and we can start both the containers as a service as there is no necessity to start them individually.

Installing Docker-Compose:

Execute below 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

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 # To hold the odoo and postgres data

Adding the contents into ./docker-compose.yml:

Sample File , Run below command

nano docker-compose.yml

Odoo sample Config file needed to add inside ./config/odoo.conf to map the volume inside the container.

[options]

Run :

You can see the log from both the postgres as well as odoo. Once it is running we can access it from http://localhost:9090.

Extra Intformation- 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 packages inside 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

intforce software is software service company and providing complete IT solution with fresh perspective. https://intforcesoftware.com/