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.

Lets begin.

The 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 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 db  --env POSTGRES_USER=odoo --env POSTGRES_PASSWORD=secret-pw --volumes-from db-data library/postgres:9.4

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

docker logs 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 odoo-data odoo:10.0 /bin/true

And run Odoo:

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

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

docker logs 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 odoo
docker rm odoo
docker rm odoo-data

docker stop db
docker rm db
docker rm db-data

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

Happy Odooing!