Action server in docker-compose does not work

Hey. I am using docker-compose to create bots and their actions servers, follow this: Running Rasa with Docker

However, it seems it is not working in my case. From the log i can see clearly that Action server started but the bot complained that it cannot find it:

bot_action_server_1  | 2019-10-24 21:21:55 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
bot_action_server_1  | 2019-10-24 21:21:55 INFO     rasa_sdk.executor  - Registered function for 'action_queue_health'.
bot_action_server_1  | 2019-10-24 21:21:55 INFO     rasa_sdk.executor  - Registered function for 'action_queue_depth'.
bot_action_server_1  | 2019-10-24 21:21:55 INFO     rasa_sdk.executor  - Registered function for 'queue_health_form'.
bot_action_server_1  | 2019-10-24 21:21:55 INFO     rasa_sdk.executor  - Registered function for 'queue_depth_form'.
bot_action_server_1  | 2019-10-24 21:21:55 INFO     rasa_sdk.endpoint  - Action endpoint is up and running on http ('0.0.0.0', 5055)
bot_1                | 2019-10-24 21:21:58 INFO     root  - Starting Rasa server on http://localhost:5005
bot_1                | 2019-10-24 21:22:19 ERROR    rasa.core.actions.action  - Failed to run custom action 'queue_health_form'. Couldn't co
nnect to the server at 'http://localhost:5055/webhook'. Is the server running? Error: Cannot connect to host localhost:5055 ssl:None [Cannot assign requested address]
bot_1                | 2019-10-24 21:22:19 ERROR    rasa.core.processor  - Encountered an exception while running action 'queue_health_form'. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
bot_1                | 2019-10-24 21:22:19 ERROR    rasa.core.actions.action  - Failed to run custom action 'action_queue_health'. Couldn't connect to the server at 'http://localhost:5055/webhook'. Is the server running? Error: Cannot connect to host localhost:5055 ssl:None [Cannot 
assign requested address]
bot_1                | 2019-10-24 21:22:19 ERROR    rasa.core.processor  - Encountered an exception while running action 'action_queue_healt
h'. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.

can anyone help?

1 Like
action_endpoint:
  url: http://action_server:5055/webhook

Did you config the endpoint.yml like this ? The error message said rasa server can not connect to the action server at http://localhost:5055/webhook. It shouldn’t try to connect to localhost but to the service action_server.

Can you post your docker-compose? That will help us know which ports are mapped to the host machine so that they are discoverable

Oh you are right. I changed it to bot_action_server and it works. Thank you so much! But I am not really understand, I thought docker-compose will map all the ports to localhost, no?

yes, here is:

version: '3.0'
services:
  bot:
    image: rasa/rasa:latest-full
    ports:
      - 5005:5005
    volumes:
      - ./bot:/app
    command:
      - run

  bot_action_server:
    image: rasa/rasa-sdk:latest
    volumes:
      - ./bot/actions:/app/actions
    ports:
      - 5055:5055

basically same as the tutorial.

Well, the docker compose creates 2 docker containers for the services “rasa” and “action_server” in the same docker network. These containers are isolated to your machine, you can imagine these as mini-machines run on your computer (don’t quote me on this). By default, rasa and action server can be accessed through localhost, but in this case, it’s the localhost of the docker containers (which means you have to access through the container IP instead of localhost).

And because the docker containers are on the same docker network, they can refer to each other’s IP by their service names, which means “action_server:5055…” is “action_server_container_ip:5055”.

Hope my explanation isn’t too bad. You can read more about this on Docker’s document.

1 Like

Thank you so much. Very helpful.