Hi all, I am trying to run rasa using docker-composse that has three services: Rasa, Django custom actions server and the database.

However, I have the following error:

Rasa.core.tracker_store - Could not create tables: (psycopg2.OperationalError) could not connect to server: Connection refused Is the server running on host “” and accepting TCP/IP connections on port 5432?

The same error raised when the web services for my action server is trying to connect to the database.

Here is the content of my docker-compose file:

version: '3.0'
    image: postgres:latest
      - pg-db-data:/var/lib/postgresql/data
    image: rasa/rasa:latest-full
      - 5005:5005
      - .:/app
    command: >
      run --model bot/models/20190926-122649.tar.gz --endpoints bot/endpoints.yml --credentials bot/credentials.yml --enable-api --debug
      - .:/app
    build: .
    command: python runserver 
      - "8000:8000"
      - postgres

What I suspect is that it is an environment error. I tried to change the port from “127.0.01” to “” where the postgres service indicated rasa is running, but still nothing. I tried many other things, but sill not working Is someone, have a guess of how I can solve that ?

Thanks in advance.

Hi @Rogers_ntr not sure if you’re still having this issue (sorry for the late response), but I think looking at the docker-compose file for Rasa X may help you, to see how to setup postgres properly: Deploy to a Server

Thanks @akelad for the answer. The issue is still there. I still encounter the problem. I have taken a close look to the Rasa X example, but still get the same error actually after many trials.

This might be worth a shot…

Any code you have running in the docker containers will be able to resolve the name of each service in your docker-compose file to the ip address assigned to the docker container running that service. The docker containers are usually assigned an ip address in the block, iirc.

So, in your action server, instead of trying to connect to or - try connecting to postgres instead - just replace the ip address with the string “postgres”, because that’s what you called your db service in the docker compose file. The docker dns resolver will then map this to the actual ip address the postgres service container has been assigned, and you should be able to connect.

Hope that helps.

hm yeah could you share your tracker store definition in the endpoints file actually?

@akelad @netcarver Thanks for the replies. Here is the tracker store:

  type: SQL
  dialect: "postgresql"
  port: 5432
  db: 'conversation'
  username: 'rogers'
  password: '<a_password>'
  url: 'postgres

I tried to change the username to postgres string, but the same error still occured. Any clue ?

@Rogers_ntr sorry for never getting back to you - have you since resolved this?

This is happening to me too. Not able to resolve, couldn’t find the solution.

@Rogers_ntr Any solution on this? Whilst connecting Postgress using docker?