1. PostgreSQL
$ docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo -e POSTGRES_DB=postgres --name db postgres:10
2. Odoo 实例
$ 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.
Postgres的容器别名应该设置为db,这样Odoo才能连接到Postgres服务器
3. 关闭和启动Odoo
$ docker stop odoo
$ docker start -a odoo
4. 关闭和启动Postgres
When a PostgreSQL server is restarted, the Odoo instances linked to that server must be restarted as well because the server address has changed and the link is thus broken.
当PostgreSQL重启,连接到这个数据服务器的Odoo实例也需要重启,因为数据服务器的地址变化了,原来的连接失效了。
Restarting a PostgreSQL server does not affect the created databases.
4. 使用自定义配置运行Odoo
5. 加载另外的Odoo插件
6. 运行多个Odoo实例
7. 环境变量
Tweak these environment variables to easily connect to a postgres server:
修改这些环境变量轻松连接postgres服务器
- HOST: The address of the postgres server. If you used a postgres container, set to the name of the container. Defaults to db.
- PORT: The port the postgres server is listening to. Defaults to 5432.
- USER: The postgres role with which Odoo will connect. If you used a postgres container, set to the same value as POSTGRES_USER. Defaults to odoo.
- PASSWORD: The password of the postgres role with which Odoo will connect. If you used a postgres container, set to the same value as POSTGRES_PASSWORD. Defaults to odoo.
8. Docker Compose
version: '2'
services:
web:
image: odoo:12.0
depends_on:
- db
ports:
- "8069:8069"
db:
image: postgres:10
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
网友评论