Odoo docker image build tutorial

In docker hub there is a complete package to install a odoo in docer. But in this way odoo will install as a python package.

For install Odoo it prefer python 2.7 and postgresql as database. For my personal experience if need all fill in local machine and build a docker image I follow some steps and it run perfectly.

First : setup docker in My Ubuntu 16.4

Second : download odoo files from github. Go to desired folder and run this command git clone https://github.com/odoo/odoo

Third : In root folder directory create a file Dockerfile

Fourth : As we want to build everything so write those code in Dockerfile File

FROM python:2.7-onbuild RUN apt-get update
RUN apt-get install -y libsasl2-dev python-dev libldap2-dev libssl-dev python-psycopg2 libpq-dev libxslt1-dev zlib1g-dev python-ldap nodejs npm


Fifth : Now create a docker-compose.yml file in project root directory

Sixth : Write those code in docker-compose.yml In next steps I will explain the code

version: '2' services:
web: build: . restart: always image: odoo_inventory depends_on: - db ports: - "8069:8069" volumes: - .:/usr/src/app - ./config/odoo.conf:/etc/odoo.conf command: python odoo-bin -c /etc/odoo.conf --xmlrpc-port 8069 links: - db

db: image: postgres:9.4 environment: - POSTGRES_PASSWORD=odoo - POSTGRES_USER=odoo - PGDATA=/var/lib/postgresql/data/pgdata volumes: - odoo-db-data:/var/lib/postgresql/data/pgdata ports: - "5432:5432"

volumes: odoo-web-data: odoo-db-data:

services : we build two services one is web and another is db

web :

build : build . - mean it will build current directory Dockerfile

restart : It will restart the system if any error arise

image : name of image name

depends_on : odoo need postgresql database. this service depends on db.

ports : run odoo on port

volumes : before : this indicate the local directory and after : indicate the docker images file location

command : after build image how to run odoo. or your another project how to execute after build

links : link with other services

db: images : postgres:9.4 - download db image with docker hub

environment: create and setup a postgresql database for odoo.

volumes and ports : describe as before

volumes := volumes of current web and db

Seventh Steps :
In root directory create a folder name 'config' and create a file name odoo.conf

I fully over ride odoo conf file in here and setup database, password. there is total 56 lines

[options] addonspath = /usr/src/app/addons
passwd = admin
csv_internal_sep = ,
datadir = /root/.local/share/Odoo
host = db
dbport = 5432
user = odoo
dbpassword = odoo
maxconn = 64
dbname = False
template = template1
dbfilter = .*
demo = {}
emailfrom = False
database = /usr/share/GeoIP/GeoLiteCity.dat
importpartial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
request = 8192
limit_time_cpu = 60
limit_time_real = 120
limit_time_real_cron = -1
listdb = True
db = False
log_db_level = warning
loghandler = :INFO
level = info
logfile = None
logrotate = False
longpollingport = 8072
max_cron_threads = 2
osv_memory_age_limit = 1.0
osv_memory_count_limit = False
path = None
pidfile = None
proxymode = False
reportgz = False
server_wide_modules = web,web
smtppassword = False
port = 25
smtpserver = localhost
ssl = False
smtpuser = False
syslog = False
commit = False
testenable = False
file = False
test_report_directory = False
translatemodules = ['all']
unaccent = False
demo = False
workers = 0
xmlrpc = True
xmlrpcinterface =
port = 8069

those are odoo.conf files data

If all those steps are done successfully now run a command through terminal.
docker-compose up

It need time to build images and when done you can go localhost:8069

sometimes python-ldap==2.4.27 package will show some errors to install. you can go requirements.txt files and comment out this and run again docker-compose up

Everything will be done and you will successfully run Odoo in dokcer.