Docker: Couldn't connect to the action server but it is running

I have a rasa application that runs completely locally. After that, I have built and run the app server and active server using docker. The rasa core server is working fine until calling action endpoint to run. action. I have also set up the action endpoint url in endpoint.yml (http://127.0.0.1:5055/webhook) Here is the log from rasa core server:

2021-03-04 12:59:18 DEBUG rasa.core.actions.action - Calling action endpoint to run action 'action_form_search'.

2021-03-04 12:59:18 ERROR rasa.core.actions.action - Failed to run custom action 'action_form_search'. Couldn't connect to the server at 'http://127.0.0.1:5055/webhook'. Is the server running? Error: Cannot connect to host 127.0.0.1:5055 ssl:default [Connection refused]

2021-03-04 12:59:18 ERROR rasa.core.processor - Encountered an exception while running action 'action_form_search'.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.8/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection

return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa

File "uvloop/loop.pyx", line 1974, in create_connection

File "uvloop/loop.pyx", line 1951, in uvloop.loop.Loop.create_connection

ConnectionRefusedError: [Errno 111] Connection refused


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


Traceback (most recent call last):

File "/opt/venv/lib/python3.8/site-packages/rasa/core/actions/action.py", line 670, in run

response = await self.action_endpoint.request(

File "/opt/venv/lib/python3.8/site-packages/rasa/utils/endpoints.py", line 146, in request

async with session.request(

File "/opt/venv/lib/python3.8/site-packages/aiohttp/client.py", line 1012, in __aenter__

self._resp = await self._coro

File "/opt/venv/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request

conn = await self._connector.connect(

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect

proto = await self._create_connection(req, traces, timeout)

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection

_, proto = await self._create_direct_connection(

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection

raise last_exc

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 980, in _create_direct_connection

transp, proto = await self._wrap_create_connection(

File "/opt/venv/lib/python3.8/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection

raise client_error(req.connection_key, exc) from exc

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 127.0.0.1:5055 ssl:default [Connection refused]

This is the log from the server

2021-03-04 12:58:29 INFO rasa_sdk.endpoint - Starting action endpoint server...

2021-03-04 12:58:30 INFO rasa_sdk.executor - Registered function for 'action_set_slot_test_1'.

2021-03-04 12:58:30 INFO rasa_sdk.executor - Registered function for 'action_set_slot_test_2'.

2021-03-04 12:58:30 INFO rasa_sdk.executor - Registered function for 'action_set_slot_test_3'.

2021-03-04 12:58:30 INFO rasa_sdk.executor - Registered function for 'action_response_test_4'.

2021-03-04 12:58:30 INFO rasa_sdk.executor - Registered function for 'action_form_search'.

2021-03-04 12:58:30 INFO rasa_sdk.endpoint - Action endpoint is up and running on http://localhost:5055

Dockerfile (to run rasa core server)

FROM rasa/rasa:2.3.2

COPY . /app

WORKDIR /app

EXPOSE 5005

COPY startup.sh /app/scripts/startup.sh

USER root
RUN pip install --no-cache rasa==2.3.2
RUN chmod a+x /app/scripts/startup.sh

WORKDIR /app

ENTRYPOINT ["bash"]

CMD ["scripts/startup.sh"]

Dockerfile (to run action server)

FROM python:3.7.5-slim

RUN apt-get update -qq

COPY . /app/actions/
COPY ./startup.sh /app/startup.sh
ADD requirements.txt /app/requirements.txt

WORKDIR /app

EXPOSE 5055

STOPSIGNAL SIGINT

USER root
RUN python -m pip install --upgrade pip
RUN pip install -r requirements.txt --no-cache-dir

RUN chmod a+rx ./startup.sh
ENTRYPOINT "./startup.sh"

Where did I go wrong? Please help me!