一、常规方法配置:
Start a PostgreSQL server
启动postgres 容器
$ docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres:9.4
Start an Odoo instance
启动Odoo容器,将其连接到postgresql容器$ docker run -p 8069:8069 --name odoo --link db:db -t odoo
The alias of the container running Postgres must be db for Odoo to be able to connect to the Postgres server.
Stop and restart an Odoo instance
停止和再启动$ docker stop odoo $ docker start -a odoo
二、映射本机目录配置:
Start a PostgreSQL server with host_pgdata mapping
启动Postgresql容器,并将本机目录/Host_pgdata数据库目录映射到该容器的数据库存放目录/usr/lib/postgresql/data$ docker run -d -v /Host_pgdata:/usr/lib/postgresql/data -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres:9.4
启动Odoo容器,将其连接到postgres容器,并将主机目录/Host_custom_addons模块目录映射到该容器模块目录/mnt/extra-addons
$ docker run -v /Host_custom_addons:/mnt/extra-addons -p 8069:8069 --name odoo --link db:db -t odoo