Skip to Content
Menu
This question has been flagged
3 Replies
8481 Views

Hi,

I installed docker (Odoo14) images using the following two commands in https://hub.docker.com/_/odoo

docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres --name db postgres:10
docker run -p 8069:8069 --name odoo --link db:db -t odoo

It works perfectly and I'm playing around with it. Also my data seems to persist. But I often see talk about volumes that need to be attached in order to achieve persistence. What's this all about? Am I doing something wrong and not realizing it?

Avatar
Discard
Best Answer

Hi Arto:

To put it very simplistically, a docker container can be created, started, stopped, and destroyed. You can start/stop containers without losing the data. However, once you destroy the container all the data within it is lost - unless you use volumes. Sort of similar to reformatting a machine.

The reason you are probably seeing the data being persisted is because you have not destroyed the container(s). If you need data to persist even after a container is destroyed, you need to map volumes where the data can be stored outside the container itself.

As mentioned by Ravi, one way to manage them is by using docker-compose. Another way is to use command line parameters to define named volumes that can be managed easily.

Docker provides great documentation that will help you develop a better understanding of the technology. The following link explains the use of volumes and will help a lot.

https://docs.docker.com/storage/volumes/

Avatar
Discard
Author Best Answer

Thanks a lot Ravi

The main reason I used docker is because I want to run odoo on my CentOS7 server, but I couldn't get it to run by direct installation. Docker initially seemed like a great and easy solution, independent of the OS and version. But now I'm having second thoughts. How am I going to upgrade it when needed. How am I going to transfer the setup from one server to another when needed. How am I going to backup my data etc.

I think I need some advice on these issues too, before committing to Odoo.
Avatar
Discard
Best Answer

when odoo docker image create container it creates volume to store data persistence but it's very inefficient to manage 
because when you look at docker volume 

command: docker volume ls

DRIVER              VOLUME NAME

local               5ce548d2cba4d9668522901083d0d7dc3adb9e553c7c4eeb13da35b684364ddf

local               6fc9685e039632b0903aeaa240fbc73567f01d65e5a597b860c9532a7c4d555e

local               9f2a99e2042005dd47cb6e63f1482b38008c83c784af83f5b5e950347919b2fe

here we could not identify which data stored by each value due to we didn't specify an explicit volume name

I would prefer to use docker-compose instead of the docker command line, compose yml file is very easy to read and early provide an explicit name of docker network, volume etc

docker volume ls 

DRIVER              VOLUME NAME

local               77ef3debbfe012f53c35c013390b394fcbb7eaabbf4d6438ccf5d2ae8c05bae8

local               root_odoo-db-data

local               root_odoo-web-data


Avatar
Discard