psycopg2.OperationalError:FATAL:数据库系统正在启动,Docker + Odoo

bvn4nwqk  于 2022-11-03  发布在  Docker
关注(0)|答案(1)|浏览(162)

我有这个docker-compose文件:

version: '3.7'

services:
  db:
    image: "postgres:9.6"
    container_name: postgres-container
    ports: ["6543:5432"]
    environment:
      - POSTGRES_USER=odoo
      - POSTGRES_PASSWORD=admin
      - POSTGRES_DB=odoo
    restart: always
    volumes:
      - ./data/postgres:/var/lib/postgresql/data

  odoo:
    #build: ./odoo-container
    image: odoo-image
    container_name: odoo-container
    ports: ["8069:8069"]
    tty: true
    command: opt/odoo/odoo-bin -c opt/odoo.conf -d teste
    depends_on:
      - db

问题是,当我启动Docker compose时,我的db服务运行,而当Docker运行odoo服务时,我得到一个错误:

psycopg2.OperationalError: FATAL:  the database system is starting up

而当我重新启动odoo容器时,它的工作原理

vtwuwzda

vtwuwzda1#

im添加了restart方法,并工作:

odoo:
  #build: ./odoo-container
  image: odoo-image
  container_name: odoo-container
  ports: ["8069:8069"]
  command: opt/odoo/odoo-bin -c opt/odoo.conf -d teste
  depends_on:
    - db
    restart: always

相关问题