Can not connect to action server from bot when running in a container

Hi all,

I created a rasa server image using following docker file


WORKDIR /app

COPY . /app

COPY ./data /app/data

USER root

RUN rasa train

VOLUME /app

VOLUME /app/data

VOLUME /app/models

USER 1001

CMD [ "run","-m","/app/models","--enable-api","--cors","*","--debug" ]

Then created an action image with following docker file

# Extend the official Rasa SDK image

FROM rasa/rasa-sdk:1.6.1

# Use subdirectory as working directory

WORKDIR /app

# Copy any additional custom requirements, if necessary (uncomment next line)

COPY actions/requirements-actions.txt ./

# Change back to root user to install dependencies

USER root

# Install extra requirements for actions code, if necessary (uncomment next line)

RUN pip install -r "requirements-actions.txt"

# Copy actions folder to working directory

COPY ./actions /app/actions

# By best practices, don't run the code with root user

USER 1001

# Start the action server

CMD ["start", "--actions", "actions", "--debug"]

Then I ran the rasaserver as

 docker run -it -v $(pwd):/app myimage:version shell

Then I ran the action server as ( ref - Building a Rasa Assistant in Docker)

docker network create my-project

docker run -v $(pwd)/actions:/app/actions --net my-project --name action_server myactionimage:latest

But then I start interaction with the bot it’s not able to connect with action server

Couldn’t connect to the server at ‘http://action_server:5055/webhook’. Is the server running? Error: C****annot connect to host action_server:5055 ssl:None [Name or service not known]

I even updated the endpoints.yaml file as

action_endpoint:

url: "http://action_server:5055/webhook"

Can anyone suggest what am I doing wrong?

Hi Nadeesh,

The hostname action_server is probably not correct. It should probably be localhost since it sounds like you’re starting both containers from the command line.

If you switch to a docker-compose setup the the hosts know each other via their service name.

Greg

@stephens Thanks. Now I tried to run it using docker-compose. Please see my docker-compose file( rasa image was based on rasa:1.6.1-spacy)

version: '3.0'
services:
 rasa_movie:
   image: myrasa:v3
   ports:
     - 5005:5005
   depends_on:
     - duckling
     - action_server
   command:
     - shell
     - -m
     - /app/models
     - --cors
     - "*"
     - --enable-api
     - --log-file
     - out.log
     - -p
     - '5005'
 action_server:
   image: myaction:v1
   ports:
     - "5055:5055"
   command:
     - start
     - --actions
     - actions
 duckling:
   image: rasa/duckling
   ports:
     - "8000:8000"

But it failed with

myrasa_1     | 2020-07-05 17:09:29 ERROR    asyncio  - Task exception was never retrieved
myrasa_1     | future: <Task finished coro=<configure_app.<locals>.run_cmdline_io() done, defined at /build/lib/python3.6/site-packages/rasa/core/run.py:124> exception=PermissionError(1, 'Operation not permitted')>
myrasa_1     | Traceback (most recent call last):
myrasa_1     |   File "/build/lib/python3.6/site-packages/rasa/core/run.py", line 128, in run_cmdline_io
myrasa_1     |     server_url=constants.DEFAULT_SERVER_FORMAT.format("http", port)
myrasa_1    |   File "/build/lib/python3.6/site-packages/rasa/core/channels/console.py", line 131, in record_messages
myrasa_1     |     text = get_user_input(button_question)
myrasa_1     |   File "/build/lib/python3.6/site-packages/rasa/core/channels/console.py", line 77, in get_user_input
myrasa_1     |     style=Style([("qmark", "#b373d6"), ("", "#b373d6")]),
myrasa_1    |   File "/build/lib/python3.6/site-packages/questionary/question.py", line 45, in ask
myrasa_1     |     return self.unsafe_ask(patch_stdout)
myrasa_1     |   File "/build/lib/python3.6/site-packages/questionary/question.py", line 59, in unsafe_ask
myrasa_1    |     return self.application.run()
myrasa_1     |   File "/build/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 736, in run
myrasa_1     |     return run()
myrasa_1       |   File "/build/lib/python3.6/site-

So far I could not figure out the issue. Any advice will help

Hi Greg, I also face issues when running the actionserver it comes to a stand still

.Please do let me know how to make this work??I have made changes to the actions.py page and also to endpoints.yml

Nadeesh,

This issue should be addressed by upgrading to 1.10.6.

Greg

@stephens Thanks