Install Odoo version 10 in Docker

Containerized Odoo

Veikko Väätäjä

Docker containers make it easy to install Odoo version 10. If you already have Docker installed, you will be running Odoo in a couple of minutes.

Let's begin.

Note:
This article is for Odoo version 10 and is written in 2016.
After release there has been updates: Odoo version 11 and new releases of Docker.
If you are looking for a new Odoo version with new Docker features, please refer to this article: "Install Odoo version 11 in Docker container". 


The container basics

We will create two containers: one for the database and one for Odoo. In fact we will create four containers because we will have an additional data container for both main containers to persist data and allow container recreation and update without losing data. 

Database container first

Fist we create a container for our database. Let's create a data container for it:

docker create --name unkkuri-db-data library/postgres:9.4 /bin/true

Next let's create and run the database. Note that we use the Postgres version 9.4 because the Odoo Docker image has Postgres 9.4 client. I don't recommend using other Postgres versions at the moment (November 2016) because you will run into trouble with backups and some other tasks.

docker run -d --name unkkuri-db  --env POSTGRES_USER=odoo --env POSTGRES_PASSWORD=unkkuri-secret-pw --volumes-from unkkuri-db-data library/postgres:9.4

And then we can check that Postgres started successfully by checking the logs:

docker logs unkkuri-db

You should see something like this in the end of the log:

...
LOG: database system is ready to accept connections

That was easy. This took about one minute. Well, depending on your internet connection speed. If you did not have Postgres images ready in your machine, I guess it took more than a minute to download them from the Docker Hub.

Then we start the Odoo container

Then it is time to start Odoo. We will do it the same way so that we have separate container for persistent storage.

docker create -v /var/lib/odoo --name unkkuri-odoo-data odoo:10.0 /bin/true

And run Odoo:

docker run -d --name unkkuri-odoo --link unkkuri-db:db -p 8069:8069 --volumes-from unkkuri-odoo-data odoo:10.0 odoo --db_password=unkkuri-secret-pw

Let's check the logs to make sure everything is running:

docker logs unkkuri-odoo

You should see the Odoo logs and in the end you should see these lines:

2016-11-07 11:50:21,865 1 INFO ? odoo: Odoo version 10.0-20161103
2016-11-07 11:50:21,866 1 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf
2016-11-07 11:50:21,866 1 INFO ? odoo: addons paths: ['/var/lib/odoo/addons/10.0', u'/mnt/extra-addons', u'/usr/lib/python2.7/dist-packages/odoo/addons']
2016-11-07 11:50:21,866 1 INFO ? odoo: database: odoo@db:5432
2016-11-07 11:50:21,890 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on 0.0.0.0:8069
Odoo CMS- Sample image floating

Now we have Odoo running in a Docker container. It's time to Odoo!

Time to Odoo

By default Odoo is accessible in port 8069 so you can navigate to http://localhost:8069. If you use Docker in virtual machine you have to change localhost to the ip-address of your Docker virtual machine, e.g. http://192.168.1.100:8069.

First you create the Odoo database. The creation takes less than a minute. After that you can install apps in Odoo and start using. 

After you create the database, remember to change the master password if your Odoo web pages are accessible to other users.

When it is time to clean up

When you are done with testing, you can delete the docker containers. Do this by stopping the running containers, removing the containers and removing the data containers. This removes all the data you created in Odoo. To delete everything type:

docker stop unkkuri-odoo
docker rm unkkuri-odoo
docker rm unkkuri-odoo-data

docker stop unkkuri-db
docker rm unkkuri-db
docker rm unkkuri-db-data


You can find Odoo in GitHub here: https://github.com/odoo/odoo. You can find the official Odoo Docker images in Odoo repository here: https://github.com/odoo/docker. You can find the official Odoo container from Docker hub here: https://hub.docker.com/_/odoo/, and the PostgreSQL library from here: https://hub.docker.com/_/postgres/.

If you have questions about how to use Odoo in your business, I am happy to answer them and help you. 

Happy Odooing!