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.
- 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.
- 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.
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
mkdir ./config && touch config/odoo.conf
mkdir ./enterprise #For adding the enterprise addons
mkdir ./data/postgres # To hold the odoo and postgres data
Adding the contents into ./docker-compose.yml:
Sample File , Run below command
# Information needed set up an odoo web
# application container.
# Port Mapping
#We are going to map the host machine(left side) with the
#Port inside the container (the right).
#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
# 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.
#Username and password of the Host DB
# Make sure to give the same credentials inside the postgres service
- HOST=db #[Hostname]
# All of the information needed to start up a Postgresql
#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
#make sure to use the same which were given above.
Odoo sample Config file 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 = /intforce/extra , /intforce/enterprise
proxy_mode = True
data_dir = /var/lib/odoo
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
Perigeon Software is a software development firm. With a fresh perspective and dedicated attention to each client, we provide a complete IT solution globally. By defining, designing, and developing solutions tailored to meet our clients’ business objectives, we ensure that our clients get the maximum return on their investment and support them in tackling evolving business and technological issues. Our mission is to provide the best customer service and expertise using the most practical and robust web technologies/software technologies to satisfy our clients’ IT objectives and to provide them with the business and competitive advantage they needed to succeed.