1. 配置扩展目录
-
odoo 配置文件
/opt/odoo/config/odoo.conf # 内容 [options] addons_path = /mnt/extra-addons db_host = localhost db_user = odoo db_name = odoo db_password = odoo
-
docker-composer.yml 配置
version: '3.1' services: web: image: odoo:14 ports: - "8069:8069" # 网络模式:共享主机网络 network_mode: host volumes: - /opt/odoo/odoo-data:/var/lib/odoo - /opt/odoo/config:/etc/odoo - /opt/odoo/addons:/mnt/extra-addons environment: - HOST=localhost - USER=odoo - PASSWORD=odoo
-
添加python项目 pip模块依赖
/opt/odoo/addons/requirements.txt # 配置内容 pandas qiniu pyOpenSSL M2Crypto
-
启动服务(前台方式)
docker-compose up
-
安装依赖(新 ssh 窗口)
docker exec -it --user root odoo_web bash # 进入容器 sed -i 's/deb.debian.org/repo.huaweicloud.com/g' /etc/apt/sources.list apt install -y swig gcc python3-dev # 安装pip基础包 pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple wheel pip3 install --upgrade -i https://repo.huaweicloud.com/repository/pypi/simple pip # 安装requirements.txt中的依赖包 pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple -r /mnt/extra-addons/requirements.txt
-
重新启动容器(后台访问 -d)
dockder-compose up -d