How to install Odoo with docker and add external modules

In the article Step by step to set up an ERP and CRM for your SME We taught how to run a virtual machine that had a preconfigured Odoo 8 installation, which allowed us to enjoy this ERP in a simple and fast way, this time we want to enter the world of Docker and install Odoo using this great technology.

Basically with this tutorial you will learn how to install Odoo with docker and add external modules that will allow you to improve and expand Odoo's functionalities. Thanks to docker, you can have any version of Odoo on the same computer and have multiple instances running, which will facilitate development and start-up at any time, in any organization and especially in any environment.

The procedure is quite simple but I will try to make it as detailed as possible, the steps and procedures will focus on distros with Ubuntu 16.04 but can be easily applied on any Linux distro.

Steps to install Docker and Docker Compose

Install Docker

To install Docker in Ubuntu, just run the following command:

sudo apt-get install docker.io

Add your user to the Docker group

We must execute the following command:

sudo gpasswd -a ${USER} docker

Install Docker-compose

The easiest way to install Docker-ompose is using pip, to do this run the following command:

pip install docker-compose

Install Docker-engine

Install docker-engine with the following command:

sudo curl -sSL https://get.docker.com/ | sh

Restart Docker

In order for all changes to be taken properly, it is convenient to restart docker using:

sudo service docker restart

Creating our docker-compose.yml file

Once we have installed docker, we must create the file docker-compose.yml In the directory of our preference, it will contain basically all the information necessary to deploy our service with Odoo.

nano docker-compose.yml

This file will contain the following:

version: '2' services: odoo: image: odoo: 8 restart: always ports: - "8069: 8069" links: - db volumes: - ./extra-addons:/mnt/extra-addons db: image: postgres: 9.4 restart: always environment: - POSTGRES_USER = odoo - POSTGRES_PASSWORD = odoo

In this file we can make the following changes to adapt it to our requirements:

  • image: odoo:8 : You can replace odoo: 8 with the version you need odoo: 9, odoo: 10, odoo11 or just odoo: latest for the latest version available.
  • ports: - "8069:8069" : Replace the first port with the port you want, this will help you to have multiple instances of odoo running at the same time, for example it could look like this, ports: - "8070:8069"ports: - "8071:8069" and so on
  • image: postgres:9.4 : You can also replace the postgres image you want to use, particularly this version suits me quite well.

In general lines with this docker-compose.yml We invoke a set of containers that are related to each other, such as the odoo version container and the postgres container, likewise for the first container we state that it will listen to port 8069 (and it will be able to access the one we indicate) and in addition, a local volume called extra-addons is mounted that will automatically link with the / mnt / extra-addons in the odoo container.

Finally, the username and password to be used for postgres is described and it is determined that when the guest computer restarts the docker service it will also do so, thanks to the restart: always parameter.

Odoo initial setup

Once we have created our docker-compose.yml, we must start the Odoo instance, to do this from the terminal we go to the directory where the file created previously is and execute:

docker-compose up -d

The download of the necessary docker containers will start automatically, the database will start and we will be able to access our odoo instance from localhost:8069 or the port you specified. Once in it, it will be necessary to create our database, for which we must choose the email, access password, language and language, in addition to selecting if we want to import test data to evaluate Odoo.

Once the database is created we can access odoo and begin to enjoy its benefits.

Adding external modules to Odoo

El docker-compose.yml that we created in previous steps, in addition to raising the necessary odoo and postgres images, it also creates a volume in our directory to be able to add external modules to our instance. For this, it is enough that we copy a module compatible with the version of odoo that we have executed in said directory, you can add your own modules or download it from odoo apps.

Once we have our module in the extra-addons directory (unzipped) which is in the directory where we have our docker-compose.yml, we proceed to give it the corresponding permissions so that it can be read by our docker. The simple way is that located in the parent directory of extra-addons we execute the following commands from the terminal:

sudo chown -R lizard: lizard extra-addons / #replace lizard with your user sudo chmod -R 755 extra-addons /

Now from our odoo instance we must activate the developer mode which, depending on the version of odoo that you have, can be done as follows:

Activate developer mode in Odoo 8

The development mode in Odoo 8 is activated from the User profiles, to do this from the menu go to the User category, locate your administrator user and in the lower right part activate the characteristics

developer mode in odoo 8

Activate developer mode in Odoo 9

In Odoo 9 go to the upper right and click on the date that is next to the user's profile photo, then go to the About option and in the window that opens select Activate developer mode.

developer mode in odoo 9

Activate developer mode in Odoo 10 and Odoo 11

To activate the developer mode in Odoo 10 and 11 we must go to the Settings menu and in the lower right part click on Activate developer mode.

developer mode in odoo 10

developer mode in odoo 11

Finally in any of the versions we must go to the menu of local modules or apps and click on the link to update the list of modules, and then you can install the modules as explained in the article on How to install modules in Odoo.

Installing packages in our docker

It may be the case that any of the modules or utilities that you want to incorporate into odoo (or a feature of odoo itself) needs the installation of external packages, this can be done quite easy in docker thanks to docker exec which is a utility that allows us to execute commands in a docker container.

The first thing we need to know is the name of our docker instance, which is done with the following command:

docker ps

To install an application as root in a docker we must execute the following command adapting it to your needs:

docker exec -u root odoo9_odoo_1 pip install xlsxwriter

Where docker exec -u root odoo9_odoo_1  indicates that a command will be executed as root in the odoo9_odoo_1 instance and pip install xlsxwriter would be the command you want to run.

Finally I would like to share several commands that will be useful when working with docker-composer

# It runs from the directory of a docker instance and for the docker-compose that is running docker-composer stop # It runs from the directory of a docker instance and starts the docker-compose docker-composer start # Stop all containers docker stop $ (docker ps -a -q) # Delete all docker containers rm $ (docker ps -a -q) # Delete all docker images rmi $ (docker images -q)

I hope the tutorial is to your liking, in future articles we will begin to learn how to use Odoo and configure it in our SMEs.


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

14 comments, leave yours

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Bill said

    Magnificent tutorial, to see if I can take the time to put it into practice: both Odoo and Docker seem very interesting. For now I am busy to see if I learn some web-scraping using rstudio and a selenium-firefox docker, something to be explored by FromLinux.

    1.    json said

      Selenium is not for scraping it is for wrrapering. Only alcaro XD scraping is only for reading data.

      1.    Guille said

        Well, I'm trying to learn how to read data from webs and put it into a structured table or tables to handle later. According to Wikipedia:
        Web scraping is a technique used by software programs to extract information from websites. Usually, these programs simulate a human's navigation on the World Wide Web either by using the HTTP protocol manually, or by embedding a browser in an application.
        Wrapper in data mining is a program that extracts content of a particular information source and translates it into a relational form. [1] Many web pages present structured data - telephone directories, product catalogs, etc. formatted for human browsing using HTML language.
        It might be more wrapper because it is information structured in tables, yes. It is very interesting.

  2.   vistor said

    Is it possible to install it on a Raspberry pi with Ubuntu Mate?

    1.    lizard said

      If possible dear, let's see if with a little time I can do a tutorial on the subject

      1.    Hector said

        that would be excellent I have several PIs picking up dust

        1.    lizard said

          And I need one for the tests 🙁

  3.   Anonymous said

    How do I download with Spanish language? So the application is in Spanish, and if there is for Windows?

    1.    lizard said

      When creating the database you can choose the language of your preference, if it works in Windows too (it has an installer from the odoo page)

  4.   Victor said

    Hi, I am trying to install it on a Raspberry pi 3 and running the Docker script:
    docker-compose up -d

    I get the following error:

    ERROR: no matching manifest for linux / arm in the manifest list entries.

    Thank you.

  5.   Jesus said

    The tutorial is very good, thank you, and how the rest of the instances would be installed, it is not very clear to me, you have to put more in the docker-compose.yml file, thanks

  6.   Brayhan jaramillo said

    Could you please help me to find the path of the addons, am I on a mac? thank you very much

  7.   Gonzalo said

    How would it be to install the enterprise version?

  8.   Danilo said

    Hello, how would it be if I need to update a module that I am programming from the terminal?