odoo10迁移到Docker

ubuntu 安装版odoo10迁移到Docker
先创建好数据库和odoo

version: "2"
services:
  db:
    restart: always
    image: postgres:alpine
    container_name: postgres
    volumes:
      - ./postgres/db:/var/lib/postgresql/data
      - ./postgres/initdb:/docker-entrypoint-initdb.d
    environment:
      - POSTGRES_PASSWORD=mima
    networks:
      - bridge
  odoo:
    image: odoo:10.0
    container_name: odoo
    depends_on:
      - db
    ports:
      - 8090:8069
    environment:
      - USER=odoo
      - PASSWORD=odoo
      - ./odoo/data:/var/lib/odoo
      - ./odoo/config:/etc/odoo
      - ./odoo/addons:/mnt/extra-addons
    networks:
      - bridge
docker-compose up -d
docker-compose stop

迁移

cp -R /var/lib/odoo/.local/share/Odoo/* odoo/data
cp /etc/odoo/odoo.conf odoo/config/odoo.conf
# 修改 db_host = db
vim odoo/config/odoo.conf
# 数据库
su postgres
psql -U postgres
# 找数据名,记住
\l
\q
exit
pg_dump -h localhost -U postgres 数据库名>odoo.sql
# 找到数据库的IP
docker network inspect bridge
psql -U postgres -h 192.168.20.10
CREATE USER odoo WITH PASSWORD 'odoo';
CREATE DATABASE odoo;
GRANT ALL PRIVILEGES ON DATABASE odoo TO odoo;
\q
psql -U postgres -h 192.168.20.10 odoo<odoo.sql
psql -U postgres -h 192.168.20.10
ALTER DATABASE odoo OWNER TO odoo;
\q
Show Comments