Failed to run custom action 'action_query_knowledge_base'.Cannot connect to host action-server:5055 ssl:default

I am getting error Cannot connect to host action-server:5055 ssl:default [No address associated with hostname]

I am using knowledge based bot and installed and running RASA using docker. link for the eg : rasa/examples/knowledgebasebot at master · RasaHQ/rasa · GitHub

My endpoints.yml:

action_endpoint:

url: "http://action-server:5055/webhook"

My steps:

  • docker run -v ${pwd}:/app rasa/rasa:2.1.3-full train
  • docker run -d -v ${pwd}/actions:/app/actions --net my-project --name action-server rasa/rasa-sdk:2.1.2
  • docker run -it -v ${pwd}:/app -p 5005:5005 --net my-project rasa/rasa:2.1.3-full shell

I am getting this error

2020-12-13 17:09:01 ERROR    rasa.core.actions.action  - Failed to run custom action 'action_query_knowledge_base'. Couldn't connect to the server at 'http://action-server:5055/webhook'. Is the server running? Error: Cannot connect to host action-server:5055 ssl:default [No address associated with hostname]
2020-12-13 17:09:01 ERROR    rasa.core.processor  - Encountered an exception while running action 'action_query_knowledge_base'.Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
Traceback (most recent call last):
  File "/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py", line 967, in _create_direct_connection
    traces=traces), loop=self._loop)
  File "/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py", line 830, in _resolve_host
    self._resolver.resolve(host, port, family=self._family)
  File "/opt/venv/lib/python3.7/site-packages/aiohttp/resolver.py", line 30, in resolve
    host, port, type=socket.SOCK_STREAM, family=family)
  File "uvloop/loop.pyx", line 1469, in getaddrinfo
socket.gaierror: [Errno -5] No address associated with hostname

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.7/site-packages/rasa/core/actions/action.py", line 612, in run
    json=json_body, method="post", timeout=DEFAULT_REQUEST_TIMEOUT
  File "/opt/venv/lib/python3.7/site-packages/rasa/utils/endpoints.py", line 151, in request
    **kwargs,
  File "/opt/venv/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/opt/venv/lib/python3.7/site-packages/aiohttp/client.py", line 483, in _request
    timeout=real_timeout
  File "/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py", line 859, in _create_connection
    req, traces, timeout)
  File "/opt/venv/lib/python3.7/site-packages/aiohttp/connector.py", line 971, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host action-server:5055 ssl:default [No address associated with hostname]

During handling of the above exception, another exception occurred:

If you look at the setting in your endpoints.yml, Rasa is configured to look for the action server at http://action-server:5055/webhook. This is typically the hostname used in a docker-compose setup.

Since you are running under docker locally, your endpoint would be http://localhost:5055/webhook and you need to expose port 5055 when you start the action server from the docker command line.