(psycopg.OperationalError) connection failed: connection to server at "127.0.0.1",

After create my template
launch with : phi ws up --group app

I’ve this error : (psycopg.OperationalError) connection failed: connection to server at “127.0.0.1”,

the docker container pgvector is started =>
24a5588ef5ba phidata/pgvector:16 “docker-entrypoint.s…”

from typing import Optional

from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.knowledge.agent import AgentKnowledge
from phi.storage.agent.postgres import PgAgentStorage
from phi.tools.duckduckgo import DuckDuckGo
from phi.vectordb.pgvector import PgVector, SearchType
from phi.knowledge.json import JSONKnowledgeBase

from agents.settings import agent_settings
from db.session import db_url

db_url_psycopg=“postgresql+psycopg://ai:ai@localhost:5532/ai”

mzre_knowledge_base = JSONKnowledgeBase(
path=“…/json”,
vector_db=PgVector(
table_name=“mzre_json_properties”,
db_url=db_url_psycopg,
search_type=SearchType.hybrid),
)

Load the knowledge base: Comment out after first run

mzre_knowledge_base.load(recreate=True, upsert=True)

What’s wrong with the localhost ?

Hello @jayBen can you please share which template you are working with?

Additionally, the templates come with their own containers running a postgres database.

I follow this tuto → Building an Agent App - Phidata

@jayBen can you confirm if your postgres is running on docker?

yes, when i run docker ps, i see the image is running

@jayBen we need a bit more information to help. Can you maybe send us a link to your codebase and we can take a look?

I’ve found, I’m on ubuntu and for the url for docker db is not @localhost but 172.17.0.1.
thx for your help