Odoo With Docker In Windows

Odoo is an all-in-one management software that offers a range of business applications that form a complete suite of enterprise management applications targeting companies of all sizes. Odoo is an all-in-one business software including CRM, Website/e-Commerce, billing, accounting, manufacturing, warehouse- and project management, and inventory.

And Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.

Here i will explain how to setup the docker container and deploy odoo in windows.

Setting Up Docker

Docker on windows is little bit different since docker uses linux properties which windows does not support.So we will be installing a virtual machine on windows and docker images will run on them. But you can control them through windows. It sounds like a difficult task, but the docker has provided with us docker toolbox which will handle everything that i said. You can download that from here.

Download it and install through the setup wizard. I would suggest to go for a full installation including docker compose, kitematic and VirtualBox(if you do not have installed), git(since docker is linux it uses git bash to run commands). After the installation it will show two shortcuts ,a Quickstart terminal and Kitematic Alpha. Open the Quickstart terminal and it will run some commands which are used to setup the virtualbox. If it is successfull it will show the docker command line with ascii docker whale and the ip address of the docker.

The ip address of the docker is very important since we use that to access the Odoo. If you forget it, we can use a simple command that i provided below.

To test it, we can run a simple docker container by executing following. For more docker containers we can visit the docker hub , which is more like git repository.

                            
                            
docker run hello-world // pulls the image from docker hub

It only output some text to the terminal but it is a great way to test the docker.

Configuring Odoo

For configuring Odoo we have to first setup PostgreSQL image on docker and link that to the Odoo.

                            
                            
docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres:9.4 // pulls the PostgreSQL image from docker hub
docker run -p 8069:8069 --name odoo --link db:db -t odoo // pulls the Odoo image from docker hub and linking to PostgreSQL
// Specifying the Odoo version
docker run -p 8069:8069 --name odoo --link db:db -t odoo:10 // pulls the Odoo 10 image from docker hub and linking to PostgreSQL

In above code the --name is the name of the docker container. We can use that to start and stop the container. -p is the port no: that docker needed to expose to outside.

For start and stop servers we can use the following commands. After you run docker run command once don't run it again, unless you are planning for multiple instance of Odoo. Use below commands instead. Because it will download latest version again and will occupy more space.

                            
                            
docker start odoo // start the odoo
docker stop odoo // stop odoo container

For more information on this you can visit the following link. Now you can check the Odoo running on docker_ip:8069.

Extra Commands

To run docker using commandline we can use some flags that is provided by docker. You can get the list of all the commands by typing docker --help or going to there reference docs. I have listed frequently used docker commands below.

                            
                            
docker-machine ip // For checking the machine ip
docker images // list of all docker images
docker ps // list of all running docker images
docker ps -a // list of stopped and running docker images
docker rmi [container_id] // removing the container. note: must stop container first
docker pull container_image:tag // pulling the latest container from the docker hub.

Try running Odoo with Docker with this setup.