Docker Compose for Odoo 10

  May 22, 2018      2m      0   
 

It's feasible to set up Odoo development environment with Docker Compose. We only spend less than 1 minute to configure everything to run the command.

Docker Compose for Odoo 10

You can download the package included docker-compose.yml to start developing immediately: https://github.com/minhng92/odoo-10-docker-compose

Following is explaination how to use it. Skip it if you already know what to do.

The directory structure:

docker-compose-odoo-10.0
|- o_etc
    |- odoo.conf
|- o_addons
|- docker-compose.yml
|- Dockerfile
|- entrypoint.sh
|- odoo.conf

To start Odoo container, run the following commands:

$ cd /path/to/docker-compose-odoo-10.0/dir/
$ docker-compose up

Then, go to localhost:10000

docker-compose.yml

version: '2'
services:
  db:
    image: postgres:9.4
    environment:
      - POSTGRES_PASSWORD=odoo
      - POSTGRES_USER=odoo

  odoo10:
    image: odoo:10.0
    depends_on:
      - db
    ports:
      - "10000:8069"
    tty: true
    command: -- --dev=reload
    volumes:
      - ./o_addons:/mnt/extra-addons
      - ./o_etc:/etc/odoo
volumes:
  db:
  odoo10:

I bind port 10000 to the default Odoo port 8069. So you need to go to port 10000 instead of 8069. The o_addons directory contains the custom addons. The o_etc directory contains Odoo configuration file (odoo.conf) and log file (odoo-server.log will be generated after starting Odoo container).

o_etc/odoo.conf

[options]
addons_path = /mnt/extra-addons,/usr/lib/python2.7/dist-packages/odoo/addons
data_dir = /var/lib/odoo
logfile = /etc/odoo/odoo-server.log

You can see that I added /mnt/extra-addons and this directory is mounted to our o_addons directory.

In the case that your application required to install additional libraries, you need to modify Dockerfile by adding the installing commands. Then you build the new Docker image:

$ docker build -t image_name:version .

Next, you modify the image in docker-compose.yml:

version: '2'
services:
  db:
    image: postgres:9.4
    environment:
      - POSTGRES_PASSWORD=odoo
      - POSTGRES_USER=odoo

  odoo10:
    image: image_name:version
    depends_on:
      - db
    ports:
      - "10000:8069"
    tty: true
    command: -- --dev=reload
    volumes:
      - ./o_addons:/mnt/extra-addons
      - ./o_etc:/etc/odoo
volumes:
  db:
  odoo10:

Now, you can start the container normally.

The offical Odoo reposition on Docker Hub: https://hub.docker.com/_/odoo/

Just ask me if you have any issues.

More references:


Updated on May 22, 2018:

Github: https://github.com/minhng92/odoo-10-docker-compose


Odoo posts:


Khám phá Odoo


Khám phá xử lý ảnh - GVGroup




-->