Home > Software design >  psycopg2.OperationalError: FATAL: the database system is starting up, Docker Odoo
psycopg2.OperationalError: FATAL: the database system is starting up, Docker Odoo

Time:01-10

i have this docker-compose file:

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

the problem is that when i start docker compose, my db service runs and when docker runs the odoo service i get an error:

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

and when i restart the odoo container, its works

CodePudding user response:

im added the restart method, and works:

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 
  •  Tags:  
  • Related