# RUNNING RASA WITH DOCKER DOES NOT WORK

**URL:** <https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742>\
**Category:** Rasa Open Source\
**Created:** [November 26, 2019, 4:20pm UTC](https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742 "2019-11-26T16:20:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rogers\_ntr](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rogers_ntr/32/3067_2.png) [@Rogers\_ntr](https://forum.rasa.com/u/Rogers_ntr)\
**Post date:** [November 26, 2019, 4:20pm UTC](https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742/1 "2019-11-26T16:20:32Z")

</div>

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 “127.0.0.1” 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'
> services:
> postgres:
> image: postgres:latest
> volumes:
> - pg-db-data:/var/lib/postgresql/data
> rasa:
> image: rasa/rasa:latest-full
> ports:
> - 5005:5005
> volumes:
> - .:/app
> command: >
> run --model bot/models/20190926-122649.tar.gz --endpoints bot/endpoints.yml --credentials bot/credentials.yml --enable-api --debug
> web:
> volumes:
> - .:/app
> build: .
> command: python manage.py runserver 
> ports:
> - "8000:8000"
> depends_on:
> - postgres
> volumes:
> pg-db-data:
> 
> ```

What I suspect is that it is an environment error. I tried to change the port from “127.0.01” to “0.0.0.0” 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.

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [December 5, 2019, 1:23pm UTC](https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742/2 "2019-12-05T13:23:31Z")

</div>

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](https://rasa.com/docs/rasa-x/deploy/)

---

<div class="post-metadata">

**Author:** ![Rogers\_ntr](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rogers_ntr/32/3067_2.png) [@Rogers\_ntr](https://forum.rasa.com/u/Rogers_ntr)\
**Post date:** [December 5, 2019, 2:56pm UTC](https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742/3 "2019-12-05T14:56:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![netcarver](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/netcarver/32/1147_2.png) [@netcarver](https://forum.rasa.com/u/netcarver)\
**Post date:** [December 5, 2019, 4:15pm UTC](https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742/4 "2019-12-05T16:15:06Z")

</div>

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 172.xxx.yyy.zzz block, iirc.

So, in your action server, instead of trying to connect to 127.0.0.1 or 0.0.0.0 - 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.

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [December 6, 2019, 10:53am UTC](https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742/5 "2019-12-06T10:53:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rogers\_ntr](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rogers_ntr/32/3067_2.png) [@Rogers\_ntr](https://forum.rasa.com/u/Rogers_ntr)\
**Post date:** [December 15, 2019, 5:17pm UTC](https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742/6 "2019-12-15T17:17:43Z")

</div>

@akelad @netcarverThanks for the replies. Here is the tracker store:

```
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 ?

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [January 20, 2020, 12:11pm UTC](https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742/7 "2020-01-20T12:11:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![YesayaSoftware](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/yesayasoftware/32/18129_2.png) [@YesayaSoftware](https://forum.rasa.com/u/YesayaSoftware)\
**Post date:** [June 26, 2021, 8:46am UTC](https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742/8 "2021-06-26T08:46:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 13, 2021, 11:43am UTC](https://forum.rasa.com/t/running-rasa-with-docker-does-not-work/21742/9 "2021-07-13T11:43:38Z")

</div>

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