Cant connect to duckling running on docker

I am using docker to run my rasa server and it cant connect to duckling that is also running .

I used docker-compose to spin up my rasa servers including duckling and this is the docker-compose.yml

version: '3.0'
services:
  rasa:
    image: bot_main:v4
    ports:
      - "5005:5005"
  action_server:
    image: bot_action:v1
    ports:
      - 5055
  duckling:
    image: rasa/duckling
    ports:
      - "8000:8000"

When running the server i get the error below:

2019-10-03 22:35:16 ERROR rasa.nlu.extractors.duckling_http_extractor - Failed to connect to duckling http server. Make sure the duckling server is running and the proper host and port are set in the configuration. More information on how to run the server can be found on github: GitHub - facebook/duckling: Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings. Error: HTTPConnectionPool(host=ā€˜localhostā€™, port=8000): Max retries exceeded with url: /parse (Caused by NewConnectionError(ā€™<urllib3.connection.HTTPConnection object at 0x7fbd54a78c50>: Failed to establish a new connection: [Errno 111] Connection refusedā€™,))

My config.yml file that is also in the image that i am using looks like:

language: en
pipeline:
    - name: "SpacyNLP"
    - name: "SpacyTokenizer"
    - name: "SpacyFeaturizer"
    - name: "RegexFeaturizer"
    - name: "CRFEntityExtractor"
    - name: "EntitySynonymMapper"
    - name: "SklearnIntentClassifier"
    - name: "DucklingHTTPExtractor"
      url: "http://duckling:8000"
policies:
  - name: MemoizationPolicy
  - name: KerasPolicy
  - name: MappingPolicy
  - name: FormPolicy

So these are the troubleshooting steps i took:

  • from docker ps I can see that the container is running. Since I also did the port binding, from the host I can point a browser to the duckling server and i get a respose meaning that it is running.

  • If i docker exec into the rasa server, I can ping ā€œducklingā€ meaning that there virtual network between the containers are working.

  • the rasa server can reach the action server so it also means that the virtual network is working fine.

The thing that I find bizarre is that in the error message, for some reason, the error refers to ā€œlocalhostā€ as the host for duckling and not what is in the config file.

Anyone out there with some bright ideas how to fix this???

According to the docker compose file, there is no link between rasa container and duckling container. Youā€™ll need to add depends_on key with values of containers you want it to have IP addresses for.

Try updating your docker-compose.yml as

`

version: '3.0'
services:
  rasa:
    image: bot_main:v4
    ports:
      - "5005:5005"
    depends_on:
      - duckling
      - action_server
  action_server:
    image: bot_action:v1
    ports:
      - 5055
  duckling:
    image: rasa/duckling
    ports:
      - "8000:8000"

And try spinning up the instances. You can find more details about the key on the Compose file reference

Edit: Added the action_server in depends_on list as well

Thanks for your response Vishal, I put in the depends_on key and unfortunately the issue persists :frowning:

What surprises me is that it runs the actions on the action server without any problems meaning the virtual environment for the containers is working as its supposed to. I am wondering if rasa is getting the url for the duckling server in the config file well coz despite setting the url as http:duckling:8000 it still looks for it on localhost

Figured out where the issue was. I basically needed to retrain the model. Thing isā€¦ this was part of a process to move my dev environment to docker

The reason why it works after retraining is that the settings of the conifg file

- name: "DucklingHTTPExtractor" url: "http://duckling:8000""

are only replaced in the created model when you retrain the model.

2 Likes

I spent so long rebuilding the docker containers that I forgot about the basics :rofl: thank you, your comment really helped me!