Rasa docker connecting to another docker API not working

Hi, I have a Rasa server and actions server in a single docker. I am able to send requests using HTTP API from my website. I want Rasa docker to send REST API requests to another docker installed on the same server ,using the docker container name instead of a hostname or domain name but this is not working.

My endpoints.yml file: #action_endpoint: url: “http://mydocker:5005/webhook#action server api_url: “http://apidocker:1234/#apidocker is name of another container

Thanks in advance!

Hello,

You are trying to configure your Rasa server to send REST API requests to another Docker container using the container name. Make sure both Docker containers are on the same Docker network. You can create a custom network and connect both containers to it. For example: docker network create mynetwork docker run --network mynetwork --name mydocker … docker run --network mynetwork --name apidocker … Verify that the container names (mydocker and apidocker) are correctly specified in your endpoints.yml file.your endpoints.yml file is correctly configured. It should look ReadTheory something like this: action_endpoint: url: “http://mydocker:5005/webhook” api_url: url: “http://apidocker:1234/” From within the Rasa container, try to ping the apidocker container to ensure they can communicate: docker exec -it mydocker ping apidocker Review the logs of both containers to identify any errors or issues that might be preventing the connection. You can check the logs using: docker logs mydocker docker logs apidocker.

Best Regard, Faruk

It sounds like you’re trying to connect your Rasa server to another Docker container using container names instead of hostnames or domain names. Unfortunately, Docker containers don’t resolve container names by default, which is causing the issue.

Here’s a workaround:

  1. Use Docker’s Internal DNS: Docker provides an internal DNS server that resolves container names to IP addresses. You can use the container name directly in your endpoints.yml file, but you need to ensure that both containers are on the same Docker network.

  2. Create a Docker Network: Create a custom Docker network and connect both containers to this network. This will allow them to communicate using container names.

Here’s how you can do it:

# Create a custom Docker network
docker network create my_network

# Run your Rasa container and connect it to the custom network
docker run --name rasa_server --network my_network -d rasa/rasa:latest

# Run your actions container and connect it to the custom network
docker run --name actions_server --network my_network -d rasa/rasa:latest

# Update your endpoints.yml file
action_endpoint:
  url: "http://actions_server:5005/webhook"
  api_url: "http://rasa_server:5005/webhook"

By connecting both containers to the same Docker network, they can communicate using their container names.

Does this help resolve your issue?