Re: Creating a docker image of odoo with some modules already
installed

I am Larry, a software engineering intern.
I need to create a docker image of odoo with
some modules preinstalled for our
implementation. I am new to both docker and
odoo and am looking for some guidance on
moving forward. I am hoping someone in the
community has already done something.

What I have done is pull the official odoo
from docker hub, run it and installed all the
modules we'll need. And did some
customization(change logo, and company name)

Saved the image to a tar file using the
following docker command

docker
save -o <save image to path> <image
name>

I saved both the postgres image and the
odoo image. So in another machine I tried
loading the images and I was expecting that it
will still have all the configuration I did.
That is, it will already have all those
modules installed and also the company related
customization. But after loading the image and
running it, I had a fresh odoo instance.

So how can I create and image with some
preinstalled modules and custom configurations
packaged in the image.

I propose a different approach:
Dump the database to a file and reread it.
This can easily be done with the dumper.py script and Dockerfile I
added in the attached archive.
dumper.py assumes a folder structure as outlined in the README.txt
below.
The odoo maker suite mentioned in the README allows to do this also
across servers and different odoo sites.

create dbdumper image:
----------------------
to be able to do transfer data from/to a database within docker,
we need a dbdumer image
this can be created as follows:

cd dumper
# make sure that the ubuntu version used in the dockerfile
# employs the same postgres version, as the one running in
the container named 'db'
docker build -t dbdumper . # this creates the image
test it:
dbdumper assumes a directory layout as described under
"use dbdumper image:"
assuming that your odoo instances are in the folder
/root/odoo_instances/root/odoo_instances
you can run the following command:
docker run -v /root/odoo_instances:/mnt/sites
--rm=true --link db:db -it dbdumper -h

use dbdumper image:
-------------------
dbdumper expects the following directory layout
BASEDIR can be any folder:
BASEDIR/dumper
with dumper.py
...
BASEDIR/SITENAME
addons
additional addons (not used by dbdumper)
dump
to this folder the database will be dumped to / read
from
etc
here is odoo's config file (not used by dbdumper)
filestore
here are the external files stored (not used by
dbdumper)(not used by dbdumper)
log
here is odoos log file stored (not used by dbdumper)
ssl
(not used by dbdumper)